Sha256: 7b11585782b2e367935a14cd692fe78f5fed31bbddf269f7d2aa8bf4d7b86634

Contents?: true

Size: 1.68 KB

Versions: 30

Compression:

Stored size: 1.68 KB

Contents

module ThemeHelper
  # This allows you to generate a page-header component
  def page_header(data, presenter = nil)
    data = ThemePresentation.wrap(data, PageHeaderPresenter, presenter)
    render 'woople-theme/page_header', header: data
  end

  def content_items(items, presenter = nil)
    collection = ThemePresentation.wrap_collection(items, ContentItemPresenter, presenter)
    render partial: 'woople-theme/content_item', collection: collection
  end

  def video_modal(video, presenter = nil)
    video = ThemePresentation.wrap(video, presenter)
    render 'woople-theme/video_modal', video: video
  end

  def content_item_header
    render partial: 'woople-theme/content_item_header'
  end

  def outline(item, &block)
    presenter = ThemePresentation.wrap(item, OutlinePresenter)
    presenter.view_context = self

    render partial: 'woople-theme/outline', locals: { outline: presenter, block: block }
  end

  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

  def menu
    if !respond_to?(WoopleTheme.configuration.menu_helper)
      raise "#{WoopleTheme.configuration.menu_helper} helper_method does not exist. WoopleTheme.configuration.menu_helper must point to a valid helper_method."
    end

    model = ThemePresentation.wrap(send(WoopleTheme.configuration.menu_helper), MenuPresenter)
    render 'woople-theme/menu', menu: model
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
woople-theme-0.2.28 app/helpers/theme_helper.rb
woople-theme-0.2.27 app/helpers/theme_helper.rb
woople-theme-0.2.26 app/helpers/theme_helper.rb
woople-theme-0.2.25 app/helpers/theme_helper.rb
woople-theme-0.2.24 app/helpers/theme_helper.rb
woople-theme-0.2.23 app/helpers/theme_helper.rb
woople-theme-0.2.22 app/helpers/theme_helper.rb
woople-theme-0.2.21 app/helpers/theme_helper.rb
woople-theme-0.2.20 app/helpers/theme_helper.rb
woople-theme-0.2.19 app/helpers/theme_helper.rb
woople-theme-0.2.18 app/helpers/theme_helper.rb
woople-theme-0.2.17 app/helpers/theme_helper.rb
woople-theme-0.2.16 app/helpers/theme_helper.rb
woople-theme-0.2.15 app/helpers/theme_helper.rb
woople-theme-0.2.14 app/helpers/theme_helper.rb
woople-theme-0.2.13 app/helpers/theme_helper.rb
woople-theme-0.2.12 app/helpers/theme_helper.rb
woople-theme-0.2.11 app/helpers/theme_helper.rb
woople-theme-0.2.10 app/helpers/theme_helper.rb
woople-theme-0.2.9 app/helpers/theme_helper.rb