Class: Sunrise::Config::Group

Inherits:
Base
  • Object
show all
Includes:
HasFields
Defined in:
lib/sunrise/config/group.rb

Instance Attribute Summary

Attributes inherited from Base

#abstract_model, #name, #parent

Instance Method Summary collapse

Methods included from HasFields

#field, #fields, #nested_attributes

Methods inherited from Base

register_class_option, register_instance_option, #register_instance_option

Constructor Details

#initialize(abstract_model, parent, name = :default, options = nil) ⇒ Group

Returns a new instance of Group.



11
12
13
14
15
# File 'lib/sunrise/config/group.rb', line 11

def initialize(abstract_model, parent, name = :default, options = nil)
  options = { name: name }.merge(options || {})
  super(abstract_model, parent, options)
  @name = name.to_s.tr(' ', '_').downcase.to_sym
end

Instance Method Details

#bottom?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/sunrise/config/group.rb', line 27

def bottom?
  @config_options[:holder] == :bottom
end

#sidebar?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/sunrise/config/group.rb', line 23

def sidebar?
  @config_options[:holder] == :sidebar
end

#titleObject



17
18
19
20
21
# File 'lib/sunrise/config/group.rb', line 17

def title
  return false if @config_options[:title] === false

  @config_options[:title] || I18n.t(@name, scope: [:manage, :groups])
end