Sha256: daef73d7580c38636ac051ba7fc03cdd088d1390be3f2d1860dff323bf9c1117

Contents?: true

Size: 527 Bytes

Versions: 22

Compression:

Stored size: 527 Bytes

Contents

require 'explicit_delegator'
require_relative 'content_image'

class PageHeaderPresenter < ExplicitDelegator
  include ContentImage

  enforce_definitions :description

  def title
    name || @delegate.title
  end

  def image_class
    'page-header-with-image' if has_image?
  end

  def completed_class
    'completed' if @delegate.completed?
  end

  private

  def has_image?
    @delegate.respond_to?(:image)
  end

  def name
    if @delegate.respond_to?(:name)
      @delegate.name
    else
      nil
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
woople-theme-0.8.1 app/presenters/page_header_presenter.rb
woople-theme-0.8.0 app/presenters/page_header_presenter.rb