Module: Emenu
- Defined in:
- lib/emenu.rb,
lib/generators/emenu/install_generator.rb
Defined Under Namespace
Classes: InstallGenerator
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
27
28
29
30
31
|
# File 'lib/emenu.rb', line 27
def self.included(base)
base.before_filter :emenu
base.send :helper_method, :menu_will_render
base.module_eval { include Navigation } unless $install == true
end
|
Instance Method Details
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/emenu.rb', line 16
def
session[:menu_state] ||= {}
@menu =
selected_key = @menu.find_path(request.env['PATH_INFO'])
unless selected_key.nil?
@menu.selected = selected_key
@menu.find(selected_key).parents.each { || session[:menu_state][.title.to_s] = "opened" }
end
session[:menu_state].each { |key, value| @menu.open(key.to_sym) if value == "opened"} unless session[:menu_state].nil?
end
|
10
11
12
13
14
|
# File 'lib/emenu.rb', line 10
def
session[:menu_state] ||= {}
session[:menu_state][params[:id]] = params[:state] unless params[:id].nil?
render :json => { :data => :ok }
end
|
33
34
35
|
# File 'lib/emenu.rb', line 33
def
@menu.render
end
|