Sha256: 8ffeac81efd1a87c3007fd82b3d53017f8ada69fe9634e4fc0b80917aa762726

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

require 'active_support/concern'

module SimplePages
  module Controllers
    module PageLayoutAt
      extend ActiveSupport::Concern
      included do
        cattr_accessor :page_layout_at
        self.page_layout_at = %w{general header footer}

        helper_method :pages_layout_at
      end

      module ClassMethods
        def has_page_layout_at=(layouts = [])
          self.page_layout_at += layouts unless layouts.blank?
        end
        alias :has_page_layout_at :has_page_layout_at=
      end

      protected

      def pages_layout_at(location)
        SimplePages::Page.without_cluster.layout_at(location).published
      end

      def load_page_layout_at_options
        @layout_at_options = page_layout_at.map do |key|
          [t(key, scope: 'simple_pages.layout_at'), key]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple-pages-rails-0.6.0 lib/simple_pages/controllers/page_layout_at.rb
simple-pages-rails-0.5.0 lib/simple_pages/controllers/page_layout_at.rb
simple-pages-rails-0.4.0 lib/simple_pages/controllers/page_layout_at.rb