Module: Ramenu::ActionController::ClassMethods
- Defined in:
- lib/ramenu/action_controller.rb
Instance Method Summary collapse
-
#add_menu(name, path = nil, filter_options = {}, &block) ⇒ Object
(also: #add_menu_for_current)
add a menu.
-
#definer(name = nil, filter_options = {}, &block) ⇒ Object
define volatile menus/flags in a block.
-
#get_flag(name, filter_options = {}) ⇒ Object
get flag value.
-
#reset_flag(name, filter_options = {}) ⇒ Object
reset flag value.
-
#set_flag(name, value, filter_options = {}) ⇒ Object
set flag value.
Instance Method Details
#add_menu(name, path = nil, filter_options = {}, &block) ⇒ Object Also known as:
add a menu
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/ramenu/action_controller.rb', line 91 def (name, path = nil, = {}, &block) # This isn't really nice here if eval = Utils.convert_to_set_of_strings(.delete(:eval), %w(name path)) name = Utils.instance_proc(name) if eval.include?("name") unless path.nil? path = Utils.instance_proc(path) if eval.include?("path") end end before_filter() do |controller| # if path isn't defined, use current path path = request.fullpath if path.nil? controller.send(:add_menu, name, path, , &block) end end |
#definer(name = nil, filter_options = {}, &block) ⇒ Object
define volatile menus/flags in a block
110 111 112 113 114 |
# File 'lib/ramenu/action_controller.rb', line 110 def definer(name = nil, = {}, &block) before_filter() do |controller| controller.send(:definer, name, , &block) end end |
#get_flag(name, filter_options = {}) ⇒ Object
get flag value
66 67 68 69 70 |
# File 'lib/ramenu/action_controller.rb', line 66 def get_flag(name, = {}) before_filter() do |controller| controller.send(:get_flag, name, ) end end |
#reset_flag(name, filter_options = {}) ⇒ Object
reset flag value
80 81 82 83 84 |
# File 'lib/ramenu/action_controller.rb', line 80 def reset_flag(name, = {}) before_filter() do |controller| controller.send(:reset_flag, name, ) end end |
#set_flag(name, value, filter_options = {}) ⇒ Object
set flag value
73 74 75 76 77 |
# File 'lib/ramenu/action_controller.rb', line 73 def set_flag(name, value, = {}) before_filter() do |controller| controller.send(:set_flag, name, value, ) end end |