Sha256: 955566612fbe55b1b94ba8f53824db2e81ac38dc22f1ddaa4c6fe8d11fa476e3

Contents?: true

Size: 751 Bytes

Versions: 4

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

class ::Tramway::Page::PagesController < ::Tramway::Page::ApplicationController
  layout 'tramway/landing/application'

  def show
    @page = ::Tramway::Page::Page.published.find_by slug: params[:slug]
    @blocks = @page.blocks.published.active.map do |block|
      if block.block_type.header_with_form? && block.form_url.present?
        # FIXME: in future
        @header_with_form = block.form_to_render.new(Tramway::Auth.authenticable_models.first.new, page: @page.id)
      end
      if block.block_type.in? %i[header header_with_form]
        @links = Tramway::Landing::BlockLinkDecorator.decorate @page.with_navbar_link.active
      end
      ::Tramway::Landing::BlockDecorator.decorate block
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tramway-page-1.5.4.2 app/controllers/tramway/page/pages_controller.rb
tramway-page-1.5.4.1 app/controllers/tramway/page/pages_controller.rb
tramway-page-1.5.4 app/controllers/tramway/page/pages_controller.rb
tramway-page-1.5.3.7 app/controllers/tramway/page/pages_controller.rb