Sha256: f8baa6f4baf9971952ebafbf1cb55e510fdfda1e941c8a94629bcc6638e6bbe2

Contents?: true

Size: 1.45 KB

Versions: 32

Compression:

Stored size: 1.45 KB

Contents

require 'active_support/core_ext/string/inflections'
require 'rails_admin/config/sections/base'
require 'rails_admin/config/sections/edit'
require 'rails_admin/config/sections/update'
require 'rails_admin/config/sections/create'
require 'rails_admin/config/sections/nested'
require 'rails_admin/config/sections/modal'
require 'rails_admin/config/sections/list'
require 'rails_admin/config/sections/export'
require 'rails_admin/config/sections/show'

module RailsAdmin
  module Config
    # Sections describe different views in the RailsAdmin engine. Configurable sections are
    # list and navigation.
    #
    # Each section's class object can store generic configuration about that section (such as the
    # number of visible tabs in the main navigation), while the instances (accessed via model
    # configuration objects) store model specific configuration (such as the visibility of the
    # model).
    module Sections
      def self.included(klass)
        # Register accessors for all the sections in this namespace
        constants.each do |name|
          section = RailsAdmin::Config::Sections.const_get(name)
          name = name.to_s.underscore.to_sym
          klass.send(:define_method, name) do |&block|
            @sections = {} unless @sections
            @sections[name] = section.new(self) unless @sections[name]
            @sections[name].instance_eval(&block) if block
            @sections[name]
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
rails_admin-1.0.0.rc lib/rails_admin/config/sections.rb
rails_admin-0.8.1 lib/rails_admin/config/sections.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rails_admin-0.7.0/lib/rails_admin/config/sections.rb
rails_admin-0.7.0 lib/rails_admin/config/sections.rb
rails_admin-0.6.8 lib/rails_admin/config/sections.rb
rails_admin-0.6.7 lib/rails_admin/config/sections.rb
rails_admin-0.6.6 lib/rails_admin/config/sections.rb
rails_admin-0.6.5 lib/rails_admin/config/sections.rb
rails_admin-0.6.4 lib/rails_admin/config/sections.rb
rails_admin-0.6.3 lib/rails_admin/config/sections.rb
rails_admin-0.6.2 lib/rails_admin/config/sections.rb
rails_admin-0.6.1 lib/rails_admin/config/sections.rb