Module: ThemeHelper
- Defined in:
- app/helpers/theme_helper.rb
Instance Method Summary collapse
- #breadcrumb(organization_path) ⇒ Object
- #content_item_header ⇒ Object
- #content_items(items, presenter = nil) ⇒ Object
- #impersonation_banner ⇒ Object
- #menu ⇒ Object
- #outline(item, &block) ⇒ Object
-
#page_header(data, presenter = nil) ⇒ Object
This allows you to generate a page-header component.
- #profile ⇒ Object
- #results_header(title, path) ⇒ Object
- #video_player(video) ⇒ Object
Instance Method Details
#breadcrumb(organization_path) ⇒ Object
63 64 65 66 |
# File 'app/helpers/theme_helper.rb', line 63 def (organization_path) render partial: 'woople-theme/breadcrumb', object: ThemePresentation.wrap({organization_path: organization_path}, WoopleTheme::BreadcrumbPresenter) end |
#content_item_header ⇒ Object
18 19 20 |
# File 'app/helpers/theme_helper.rb', line 18 def content_item_header render partial: 'woople-theme/content_item_header' end |
#content_items(items, presenter = nil) ⇒ Object
8 9 10 11 |
# File 'app/helpers/theme_helper.rb', line 8 def content_items(items, presenter = nil) collection = ThemePresentation.wrap_collection(items, ContentItemPresenter, presenter) render partial: 'woople-theme/content_item', collection: collection end |
#impersonation_banner ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/helpers/theme_helper.rb', line 51 def if !respond_to?(WoopleTheme.configuration.) raise "#{WoopleTheme.configuration.} helper_method does not exist. WoopleTheme.configuration.impersonation_banner_helper must point to a valid helper_method." end model = ThemePresentation.wrap(send(WoopleTheme.configuration.)) return unless model.impersonating? render 'woople-theme/impersonation_banner', impersonation: model end |
#menu ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/helpers/theme_helper.rb', line 38 def if !respond_to?(WoopleTheme.configuration.) raise "#{WoopleTheme.configuration.} helper_method does not exist. WoopleTheme.configuration.menu_helper must point to a valid helper_method." end model = ThemePresentation.wrap(send(WoopleTheme.configuration.), MenuPresenter) render 'woople-theme/menu', menu: model end |
#outline(item, &block) ⇒ Object
22 23 24 25 26 27 |
# File 'app/helpers/theme_helper.rb', line 22 def outline(item, &block) presenter = ThemePresentation.wrap(item, OutlinePresenter) presenter.view_context = self render partial: 'woople-theme/outline', locals: { outline: presenter, block: block } end |
#page_header(data, presenter = nil) ⇒ Object
This allows you to generate a page-header component
3 4 5 6 |
# File 'app/helpers/theme_helper.rb', line 3 def page_header(data, presenter = nil) data = ThemePresentation.wrap(data, PageHeaderPresenter, presenter) render 'woople-theme/page_header', header: data end |
#profile ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/helpers/theme_helper.rb', line 29 def profile if !respond_to?(WoopleTheme.configuration.profile_helper) raise "#{WoopleTheme.configuration.profile_helper} helper_method does not exist. WoopleTheme.configuration.profile_helper must point to a valid helper_method." end model = ThemePresentation.wrap(send(WoopleTheme.configuration.profile_helper), ProfilePresenter) render 'woople-theme/profile', profile: model end |
#results_header(title, path) ⇒ Object
47 48 49 |
# File 'app/helpers/theme_helper.rb', line 47 def results_header title, path render partial: 'woople-theme/results_header', locals: { title: title, path: path } end |
#video_player(video) ⇒ Object
13 14 15 16 |
# File 'app/helpers/theme_helper.rb', line 13 def video_player(video) video = ThemePresentation.wrap(video, WoopleTheme::VideoPresenter) render 'woople-theme/video_player', video: video end |