Module: SolidWebUi::ComponentHelper
- Defined in:
- app/helpers/solid_web_ui/component_helper.rb
Overview
Thin view helpers wrapping the shared Ui::* ViewComponents, so engine views read ‘swui_page(…)` instead of `render SolidWebUi::Ui::PageComponent.new(…)`. Included into each engine’s controller via ‘helper SolidWebUi::ComponentHelper`.
Instance Method Summary collapse
- #swui_page(title:, nav: [], &block) ⇒ Object
- #swui_paginator(paginator:, page_url:) ⇒ Object
- #swui_stat_card(label:, value:, tone: :neutral, href: nil) ⇒ Object
- #swui_status_badge(label:, status: nil) ⇒ Object
- #swui_table(headers:, empty_message: "Nothing to show.", &block) ⇒ Object
Instance Method Details
#swui_page(title:, nav: [], &block) ⇒ Object
8 9 10 |
# File 'app/helpers/solid_web_ui/component_helper.rb', line 8 def swui_page(title:, nav: [], &block) render(Ui::PageComponent.new(title: title, nav: nav), &block) end |
#swui_paginator(paginator:, page_url:) ⇒ Object
24 25 26 |
# File 'app/helpers/solid_web_ui/component_helper.rb', line 24 def swui_paginator(paginator:, page_url:) render(Ui::PaginatorComponent.new(paginator: paginator, page_url: page_url)) end |
#swui_stat_card(label:, value:, tone: :neutral, href: nil) ⇒ Object
12 13 14 |
# File 'app/helpers/solid_web_ui/component_helper.rb', line 12 def swui_stat_card(label:, value:, tone: :neutral, href: nil) render(Ui::StatCardComponent.new(label: label, value: value, tone: tone, href: href)) end |
#swui_status_badge(label:, status: nil) ⇒ Object
16 17 18 |
# File 'app/helpers/solid_web_ui/component_helper.rb', line 16 def swui_status_badge(label:, status: nil) render(Ui::StatusBadgeComponent.new(label: label, status: status)) end |
#swui_table(headers:, empty_message: "Nothing to show.", &block) ⇒ Object
20 21 22 |
# File 'app/helpers/solid_web_ui/component_helper.rb', line 20 def swui_table(headers:, empty_message: "Nothing to show.", &block) render(Ui::TableComponent.new(headers: headers, empty_message: ), &block) end |