Sha256: f4b7d7f25c419473868a595f9e83eb87638b83ae2e33ab6bf359331a2ffb3707

Contents?: true

Size: 995 Bytes

Versions: 1

Compression:

Stored size: 995 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

1 entries across 1 versions & 1 rubygems

Version Path
woople-theme-0.0.2 app/presenters/outline_presenter.rb