Sha256: d1caf8fadf31c0428d7ecb329b30276168e858b130c4bf17609a76c029670f04

Contents?: true

Size: 650 Bytes

Versions: 26

Compression:

Stored size: 650 Bytes

Contents

module Locomotive
  module ActionController
    module SectionHelpers

      extend ActiveSupport::Concern

      def sections(key = nil)
        if !key.nil? && key.to_sym == :sub
          @locomotive_sections[:sub] || self.controller_name.dasherize
        else
          @locomotive_sections[:main]
        end
      end

      module ClassMethods

        def sections(main, sub = nil)
          before_filter do |c|
            sub = sub.call(c) if sub.respond_to?(:call)
            sections = { main: main, sub: sub }
            c.instance_variable_set(:@locomotive_sections, sections)
          end
        end

      end

    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
locomotive_cms-2.5.7 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.6 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.6.rc2 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.6.rc1 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.5 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.4 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.3 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.2 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.1 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.0 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.0.rc3 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.0.rc2 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.5.0.rc1 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.4.1 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.4.0 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.3.1 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.3.0 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.2.3 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.2.2 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.2.1 lib/locomotive/action_controller/section_helpers.rb