Sha256: 94c2738a167d98b9112b9891ce4eafb9522454045380d8d5dc298834e955e9dc

Contents?: true

Size: 656 Bytes

Versions: 17

Compression:

Stored size: 656 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

17 entries across 17 versions & 2 rubygems

Version Path
locomotive_cms-2.0.3 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.2 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.1 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0 lib/locomotive/action_controller/section_helpers.rb
tribeca_cms-0.1.1 lib/locomotive/action_controller/section_helpers.rb
tribeca_cms-2.0.0.rc12 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc12 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc11 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc10 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc9 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc8 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc7 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc6 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc5 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc4 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc2 lib/locomotive/action_controller/section_helpers.rb
locomotive_cms-2.0.0.rc1 lib/locomotive/action_controller/section_helpers.rb