Class: EacRailsUtils::Menus::Action

Inherits:
Node
  • Object
show all
Defined in:
lib/eac_rails_utils/menus/action.rb

Constant Summary

Constants inherited from Node

Node::LABEL_TRANSLATE_KEY_PREFIX, Node::TRANSLATE_KEY_SEPARATOR

Instance Attribute Summary

Attributes inherited from Node

#custom_label

Instance Method Summary collapse

Methods inherited from Node

#auto_label, #label, #label_translate_key, #parent_label_translate_key

Instance Method Details

#keySymbol

Returns:

  • (Symbol)


14
15
16
# File 'lib/eac_rails_utils/menus/action.rb', line 14

def key
  path.map(&:to_s).join('_').to_sym
end

#to_dropdown_menu_entries(view) ⇒ Array

Parameters:

  • view (ActionView::Base)

Returns:

  • (Array)


20
21
22
# File 'lib/eac_rails_utils/menus/action.rb', line 20

def to_dropdown_menu_entries(view)
  [view_path(view)]
end

#view_path(view) ⇒ String

Parameters:

  • view (ActionView::Base)

Returns:

  • (String)


26
27
28
29
30
# File 'lib/eac_rails_utils/menus/action.rb', line 26

def view_path(view)
  path.each_with_index.inject(view) do |a, e|
    a.send(e[1] == path.count - 1 ? "#{e[0]}_path" : e[0])
  end
end