Module: Dbviewer::UiHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/dbviewer/ui_helper.rb
Instance Method Summary collapse
-
#code_block_bg_class ⇒ Object
Helper method for code blocks background that adapts to dark mode.
-
#stat_card_bg_class ⇒ Object
Returns the appropriate background class for stat cards that adapts to dark mode.
-
#theme_toggle_icon ⇒ Object
Returns the theme toggle icon based on the current theme.
-
#theme_toggle_label ⇒ Object
Returns the aria label for the theme toggle button.
-
#time_grouping_links(table_name, current_grouping) ⇒ Object
Render time grouping links.
Instance Method Details
#code_block_bg_class ⇒ Object
Helper method for code blocks background that adapts to dark mode
21 22 23 |
# File 'app/helpers/dbviewer/ui_helper.rb', line 21 def code_block_bg_class "sql-code-block" end |
#stat_card_bg_class ⇒ Object
Returns the appropriate background class for stat cards that adapts to dark mode
16 17 18 |
# File 'app/helpers/dbviewer/ui_helper.rb', line 16 def stat_card_bg_class "stat-card-bg" end |
#theme_toggle_icon ⇒ Object
Returns the theme toggle icon based on the current theme
6 7 8 |
# File 'app/helpers/dbviewer/ui_helper.rb', line 6 def theme_toggle_icon '<i class="bi bi-moon"></i><i class="bi bi-sun"></i>'.html_safe end |
#theme_toggle_label ⇒ Object
Returns the aria label for the theme toggle button
11 12 13 |
# File 'app/helpers/dbviewer/ui_helper.rb', line 11 def theme_toggle_label "Toggle dark mode" end |
#time_grouping_links(table_name, current_grouping) ⇒ Object
Render time grouping links
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/dbviewer/ui_helper.rb', line 26 def time_grouping_links(table_name, current_grouping) params = common_params content_tag(:div, class: "btn-group btn-group-sm", role: "group", 'aria-label': "Time grouping") do [ link_to("Hourly", table_path(table_name, params.merge(time_group: "hourly")), class: "btn btn-outline-primary #{current_grouping == 'hourly' ? 'active' : ''}"), link_to("Daily", table_path(table_name, params.merge(time_group: "daily")), class: "btn btn-outline-primary #{current_grouping == 'daily' ? 'active' : ''}"), link_to("Weekly", table_path(table_name, params.merge(time_group: "weekly")), class: "btn btn-outline-primary #{current_grouping == 'weekly' ? 'active' : ''}") ].join.html_safe end end |