Class: EacRailsUtils::Menus::Group
- Inherits:
-
Node
- Object
- Node
- EacRailsUtils::Menus::Group
show all
- Defined in:
- lib/eac_rails_utils/menus/group.rb
Constant Summary
collapse
- DEFAULT_PATH_FIRST_NODE =
:main_app
- SELF_LABEL_TRANSLATE_KEY_PART =
'__self'
Constants inherited
from Node
Node::LABEL_TRANSLATE_KEY_PREFIX, Node::TRANSLATE_KEY_SEPARATOR
Instance Attribute Summary
Attributes inherited from Node
#custom_label
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Node
#auto_label, #label, #parent_label_translate_key
Class Method Details
.sanitize_key(key) ⇒ Symbol
9
10
11
|
# File 'lib/eac_rails_utils/menus/group.rb', line 9
def sanitize_key(key)
key.to_sym
end
|
Instance Method Details
25
26
27
28
|
# File 'lib/eac_rails_utils/menus/group.rb', line 25
def action(*path)
child_action = ::EacRailsUtils::Menus::Action.new(path, self)
actions[child_action.key] ||= child_action
end
|
31
32
33
|
# File 'lib/eac_rails_utils/menus/group.rb', line 31
def children
(groups.values + actions.values).sort
end
|
36
37
38
39
|
# File 'lib/eac_rails_utils/menus/group.rb', line 36
def group(group_key, path_first_node = nil)
child_group = self.class.new(group_key, self, path_first_node)
groups[child_group.key] ||= child_group
end
|
#label_translate_key ⇒ String
48
49
50
51
52
|
# File 'lib/eac_rails_utils/menus/group.rb', line 48
def (view)
children.inject({}) do |a, e|
a.merge(e.label => e.(view))
end
end
|
#within {|_self| ... } ⇒ Object
54
55
56
|
# File 'lib/eac_rails_utils/menus/group.rb', line 54
def within
yield(self)
end
|