Sha256: 341ad7d7a35c097aa8d44b5e0b5e90364eaef864eab2e9f625c6c00b375f59a8

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 Bytes

Contents

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

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

    delegate :human_view_state_event_name, to: :model_class
  end

  delegate :position, to: :object
  delegate :title, to: :object
  delegate :background, to: :object
  delegate :anchor, to: :object
  delegate :description, to: :object
  delegate :anchor, to: :object
  
  def block_type
    object.block_type_text
  end

  def view_state
    object.human_view_state_name
  end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tramway-landing-1.5.2 app/decorators/tramway/landing/block_decorator.rb
tramway-landing-1.5.1.2 app/decorators/tramway/landing/block_decorator.rb
tramway-landing-1.5.1.1 app/decorators/tramway/landing/block_decorator.rb
tramway-landing-1.5.1 app/decorators/tramway/landing/block_decorator.rb
tramway-landing-1.5 app/decorators/tramway/landing/block_decorator.rb