Module: Renalware::ToggleHelper
- Included in:
- PD::AdequacyResultsComponent, PD::PETResultsComponent, Patients::MessagesComponent, Surveys::POSSComponent
- Defined in:
- app/helpers/renalware/toggle_helper.rb
Instance Method Summary collapse
- #css_toggle_link_to(row_selector:, link_title: "Toggle") ⇒ Object
-
#row_toggler(link_title: "Toggle") ⇒ Object
Create a link to be used in a tbody > tr > td that will toggle the last row in the current tbody, where the table contains multiple tbodies and the last row in each is the one that a user can toggle open/closed (to see extended detail for instance).
-
#rows_toggler(link_title: "Toggle all rows") ⇒ Object
Create a link in a thead > tr > th that will toggle the last row in all tbodies in the table, where the table contains multiple tbodies and the last row in each is the one that a user can toggle open/closed (to see extended detail for instance).
-
#table_toggler(link_title: "Toggle all rows") ⇒ Object
Non-stimulus implemention for adding a link to toggle open all togglebale rows in the table.
- #td_toggle_row(row_selector) ⇒ Object
- #th_toggle_all_rows ⇒ Object
-
#toggler(row_selector, link_title: "Toggle") ⇒ Object
Non-stimulus implemention for adding a link to toggle open all an adjacent row.
Instance Method Details
#css_toggle_link_to(row_selector:, link_title: "Toggle") ⇒ Object
5 6 7 8 9 10 |
# File 'app/helpers/renalware/toggle_helper.rb', line 5 def css_toggle_link_to(row_selector:, link_title: "Toggle") link_to link_title, "#{row_selector} .css-toggle-container", class: "button compact low-key", data: { behaviour: "css-toggler" } end |
#row_toggler(link_title: "Toggle") ⇒ Object
Create a link to be used in a tbody > tr > td that will toggle the last row in the current tbody, where the table contains multiple tbodies and the last row in each is the one that a user can toggle open/closed (to see extended detail for instance). Works in conjunction with the stimulus ToggleController. The enclosing html table must have data-controller=“toggle” attribute.
69 70 71 72 73 74 75 76 77 78 |
# File 'app/helpers/renalware/toggle_helper.rb', line 69 def row_toggler(link_title: "Toggle") link_to( "#", data: { action: "click->toggle#row" }, class: "toggler", title: link_title ) do tag.i end end |
#rows_toggler(link_title: "Toggle all rows") ⇒ Object
Create a link in a thead > tr > th that will toggle the last row in all tbodies in the table, where the table contains multiple tbodies and the last row in each is the one that a user can toggle open/closed (to see extended detail for instance). Works in conjunction with the stimulus ToggleController. The enclosing html table must have data-controller=“toggle” attribute.
53 54 55 56 57 58 59 60 61 62 |
# File 'app/helpers/renalware/toggle_helper.rb', line 53 def rows_toggler(link_title: "Toggle all rows") link_to( "#", data: { action: "toggle#table" }, class: "toggler", title: link_title ) do tag.i end end |
#table_toggler(link_title: "Toggle all rows") ⇒ Object
Non-stimulus implemention for adding a link to toggle open all togglebale rows in the table
25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/renalware/toggle_helper.rb', line 25 def table_toggler(link_title: "Toggle all rows") link_to( "#", data: { behaviour: "table-toggler" }, class: "toggler", title: link_title ) do tag.i end end |
#td_toggle_row(row_selector) ⇒ Object
42 43 44 45 46 |
# File 'app/helpers/renalware/toggle_helper.rb', line 42 def td_toggle_row(row_selector) tag.td(class: "noprint") do toggler(row_selector) end end |
#th_toggle_all_rows ⇒ Object
36 37 38 39 40 |
# File 'app/helpers/renalware/toggle_helper.rb', line 36 def th_toggle_all_rows tag.th(class: "noprint togglers") do table_toggler(link_title: "Toggle all rows") end end |
#toggler(row_selector, link_title: "Toggle") ⇒ Object
Non-stimulus implemention for adding a link to toggle open all an adjacent row
13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/renalware/toggle_helper.rb', line 13 def toggler(row_selector, link_title: "Toggle") link_to( row_selector, data: { behaviour: "toggler" }, class: "toggler", title: link_title ) do tag.i end end |