Module: Kablam::KablamHelper
- Defined in:
- lib/kablam/kablam_helper.rb
Instance Method Summary collapse
-
#disable_test ⇒ Object
TODO: Complete this 🤷.
- #hide(model) ⇒ Object
- #render_flash(partial: 'application/flash_notice', **locals) ⇒ Object
- #replace_with(id, content) ⇒ Object
-
#show(model) ⇒ Object
TODO: Use Rails UJS setData/expando to stash original state 😎.
- #undo_destroy_path(model) ⇒ Object
Instance Method Details
#disable_test ⇒ Object
TODO: Complete this 🤷
13 14 15 |
# File 'lib/kablam/kablam_helper.rb', line 13 def disable_test 'console.log("test")' end |
#hide(model) ⇒ Object
22 23 24 |
# File 'lib/kablam/kablam_helper.rb', line 22 def hide(model) raw "document.getElementById('#{model.html_id}').style.display = 'none'" end |
#render_flash(partial: 'application/flash_notice', **locals) ⇒ Object
26 27 28 29 |
# File 'lib/kablam/kablam_helper.rb', line 26 def render_flash(partial: 'application/flash_notice', **locals) html = j render partial: partial, locals: locals raw "document.getElementById('flash').innerHTML = '#{html}'" end |
#replace_with(id, content) ⇒ Object
3 4 |
# File 'lib/kablam/kablam_helper.rb', line 3 def replace_with(id, content) end |
#show(model) ⇒ Object
TODO: Use Rails UJS setData/expando to stash original state 😎
18 19 20 |
# File 'lib/kablam/kablam_helper.rb', line 18 def show(model) raw "document.getElementById('#{model.html_id}').style.display = 'table-row'" end |
#undo_destroy_path(model) ⇒ Object
6 7 8 9 10 |
# File 'lib/kablam/kablam_helper.rb', line 6 def undo_destroy_path(model) name = model.model_name.singular params = [[name, { destroyed_at: nil }]].to_h polymorphic_path("data_undo", params) end |