Sha256: 11597e1913f88873675fdaa15351da4d53c7d8531100d4bc890d9cd2b6c9a836

Contents?: true

Size: 556 Bytes

Versions: 3

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

class Tramway::Page::PageDecorator < ::Tramway::Core::ApplicationDecorator
  class << self
    def collections
      [:all]
    end

    def show_associations
      [ :blocks ]
    end
  end

  delegate :title, to: :object

  decorate_association :blocks, state_machines: [ :view_state ]

  def lead
    object.body.first 200
  end

  def link
    Tramway::Page::Engine.routes.url_helpers.page_path slug: object.slug
  end

  def public_path
    Tramway::Page::Engine.routes.url_helpers.page_path slug: object.slug
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-page-1.4.2 app/decorators/tramway/page/page_decorator.rb
tramway-page-1.4.1.1 app/decorators/tramway/page/page_decorator.rb
tramway-page-1.4.1 app/decorators/tramway/page/page_decorator.rb