Class: SimpleAdmin::Section
- Inherits:
-
Object
- Object
- SimpleAdmin::Section
- Defined in:
- lib/simple_admin/section.rb
Instance Attribute Summary collapse
-
#allow_filters ⇒ Object
Returns the value of attribute allow_filters.
-
#options ⇒ Object
Returns the value of attribute options.
-
#section ⇒ Object
Returns the value of attribute section.
Instance Method Summary collapse
- #attributes(attr_options = {}, &block) ⇒ Object
- #filters(filter_options = {}, &block) ⇒ Object
-
#initialize(interface, section, options = {}, &block) ⇒ Section
constructor
A new instance of Section.
- #sidebar(sidebar_options = {}, &block) ⇒ Object
Constructor Details
#initialize(interface, section, options = {}, &block) ⇒ Section
Returns a new instance of Section.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/simple_admin/section.rb', line 5 def initialize(interface, section, ={}, &block) @interface = interface @section = section @options = @allow_filters = (section == :index) # attributes # filters if @allow_filters instance_eval(&block) if block_given? self end |
Instance Attribute Details
#allow_filters ⇒ Object
Returns the value of attribute allow_filters.
3 4 5 |
# File 'lib/simple_admin/section.rb', line 3 def allow_filters @allow_filters end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/simple_admin/section.rb', line 3 def @options end |
#section ⇒ Object
Returns the value of attribute section.
3 4 5 |
# File 'lib/simple_admin/section.rb', line 3 def section @section end |
Instance Method Details
#attributes(attr_options = {}, &block) ⇒ Object
16 17 18 |
# File 'lib/simple_admin/section.rb', line 16 def attributes(={}, &block) self.[:attributes] ||= SimpleAdmin::Attributes.new(@interface, self, , &block) end |
#filters(filter_options = {}, &block) ⇒ Object
20 21 22 23 |
# File 'lib/simple_admin/section.rb', line 20 def filters(={}, &block) raise "Filters cannot be specified for this section" unless @allow_filters self.[:filters] ||= SimpleAdmin::Filters.new(@interface, self, , &block) end |
#sidebar(sidebar_options = {}, &block) ⇒ Object
25 26 27 28 29 |
# File 'lib/simple_admin/section.rb', line 25 def (={}, &block) [:data] = block self.[:sidebars] ||= [] self.[:sidebars] << end |