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
13
14
15
|
# File 'lib/eac_rails_utils/menus/group.rb', line 13
def sanitize_key(key)
key.to_sym
end
|
Instance Method Details
29
30
31
32
|
# File 'lib/eac_rails_utils/menus/group.rb', line 29
def action(*path)
child_action = ::EacRailsUtils::Menus::Action.new(path, self)
actions[child_action.key] ||= child_action
end
|
35
36
37
|
# File 'lib/eac_rails_utils/menus/group.rb', line 35
def children
(groups.values + actions.values).sort
end
|
40
41
42
43
|
# File 'lib/eac_rails_utils/menus/group.rb', line 40
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
52
53
54
55
56
|
# File 'lib/eac_rails_utils/menus/group.rb', line 52
def (view)
children.inject({}) do |a, e|
a.merge(e.label => e.(view))
end
end
|
#within {|_self| ... } ⇒ Object
58
59
60
|
# File 'lib/eac_rails_utils/menus/group.rb', line 58
def within
yield(self)
end
|