Sha256: ed1446dd0009bfcdda96c339e8e5872d87cf2408338ca2f2b9225f3aa5afcdb5

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

class LandingsController < ApplicationController
  before_action :find_structure, only: [:show]
  before_action :load_page_parts, only: [:show]

  caches_page :show

  def show
    template = "landings/#{@structure.slug.gsub(/[^a-z]/, '_')}"
    template = 'landings/show' unless lookup_context.exists?(template)

    @disabled_header = @structure.children.first.try(:slug) =~ /evaluation/i

    render template: template
  end

  protected

  def find_structure
    @structure = Structure.visible.with_type(StructureType.landing).find_by(slug: params[:slug])
    raise ActiveRecord::RecordNotFound, "Structure #{params[:slug]} not found" if @structure.nil?
  end

  def load_page_parts
    @parts = []
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/controllers/landings_controller.rb