Sha256: 6db23b50044f56da02ec773c7ac5a11652bf5647c4b705bbb56eaf2f94550776

Contents?: true

Size: 993 Bytes

Versions: 2

Compression:

Stored size: 993 Bytes

Contents

require 'delegate'

class OutlinePresenter < SimpleDelegator
  def assessment
    css_class = "assessment"
    css_class << " disabled" if assessment_disabled?

    yield(css_class) if has_assessment?
  end

  def render_downloads(view_context)
    wrapped_downloads = ThemePresentation.wrap_collection(downloads, OutlineDownloadPresenter)
    view_context.render partial: 'woople-theme/outline_download', collection: wrapped_downloads
  end

  def render_videos(view_context)
    wrapped_videos = ThemePresentation.wrap_collection(videos, OutlineVideoPresenter)
    view_context.render partial: 'woople-theme/outline_video', collection: wrapped_videos
  end

  private

  def downloads
    outline.downloads
  end

  def videos
    outline.videos
  end

  def assessment_disabled?
    outline.respond_to?(:assessment_enabled) && !outline.assessment_enabled
  end

  def has_assessment?
    outline.respond_to?(:assessment) && outline.assessment
  end

  def outline
    __getobj__
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
woople-theme-0.0.4 app/presenters/outline_presenter.rb
woople-theme-0.0.3 app/presenters/outline_presenter.rb