Sha256: bfce28acc5dffcb18df47d1f6f3648f7e7eaea4db16429d667dc4447da0aadbb

Contents?: true

Size: 680 Bytes

Versions: 3

Compression:

Stored size: 680 Bytes

Contents

class Tramway::Landing::BlockDecorator < ::Tramway::Core::ApplicationDecorator
  class << self
    def collections
      [ :all ]
    end

    def list_attributes
      [ :position, :view_state, :block_type ]
    end
  end

  delegate :position, to: :object
  delegate :title, to: :object
  delegate :background, to: :object
  delegate :anchor, to: :object
  delegate :description, to: :object

  def block_type
    object.block_type_text
  end

  def view_state
    object.human_view_state_name
  end

  def link
    "##{object.anchor}"
  end

  def view_state_button_color(event)
    case event
    when :publish
      :primary
    when :hide
      :secondary
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-landing-1.2.12 app/decorators/tramway/landing/block_decorator.rb
tramway-landing-1.2.11 app/decorators/tramway/landing/block_decorator.rb
tramway-landing-1.2.10 app/decorators/tramway/landing/block_decorator.rb