dynamic_menu 3.0.0.pre2 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,26 +1,19 @@
1
1
  module DynamicMenu
2
2
  class Base
3
- def initialize(current_user)
4
- @current_user = current_user
5
- build_menu
3
+
4
+ def initialize(parent)
5
+ @parent ||= parent
6
+ @menuLinks = build_menu
6
7
  end
7
8
 
8
9
  def get_menu_links
9
- @links
10
+ @menuLinks || Hash.new
10
11
  end
11
- private
12
12
 
13
- def current_user
14
- @current_user
15
- end
16
-
17
- def define_menu_links(args)
18
- if @links.nil?
19
- @links = args
20
- else
21
- @links.merge(args)
22
- end
23
- return @links
13
+ def method_missing(method, *args)
14
+ super unless @parent.methods.index method
15
+ @parent.send(method, *args)
24
16
  end
17
+
25
18
  end
26
19
  end
@@ -1,11 +1,17 @@
1
1
  module DynamicMenu
2
2
  module InheritableMenus
3
+ mattr_accessor :menu
4
+ @@menu = Hash.new
5
+
6
+
3
7
  def get_current_menu
4
8
  path = Rails.root.join('app/menus')
5
- require path + "#{params[:controller]}/#{params[:action]}.rb"
6
- current_user ||= nil
7
- menu = "#{params[:action]}Menu".classify.constantize.new(current_user)
8
- return menu
9
+ full_path = path + "#{params[:controller]}/#{params[:action]}.rb"
10
+ if File.exists?(full_path)
11
+ load full_path
12
+ "#{params[:action]}Menu".classify.constantize.new(self)
13
+ end
9
14
  end
15
+
10
16
  end
11
17
  end
@@ -1,3 +1,3 @@
1
1
  module DynamicMenu
2
- VERSION = "3.0.0.pre2"
2
+ VERSION = "3.0.0.rc1"
3
3
  end
data/lib/dynamic_menu.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module DynamicMenu
2
2
  #require 'rails'
3
3
  require "dynamic_menu/inheritable_menus.rb"
4
- require "engine.rb"
5
4
  require "dynamic_menu/base.rb"
6
- require "dynamic_menu/user_grabber.rb"
5
+ require "engine.rb"
7
6
  end
data/lib/engine.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  module DynamicMenu
2
2
  class Engine < ::Rails::Engine
3
3
  initializer "dynamic_menu.inheritable_menus" do |app|
4
- ActionController::Base.send :include, DynamicMenu::UserGrabber
5
4
  ActionView::Base.send :include, DynamicMenu::InheritableMenus
6
5
  end
7
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_menu
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre2
4
+ version: 3.0.0.rc1
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-02 00:00:00.000000000 Z
12
+ date: 2013-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &30523884 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 4.0.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *30523884
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 4.0.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: sqlite3
27
- requirement: &30523632 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *30523632
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: Dynamic_menu is a gem aimed at making menus more DRY with inheritance
37
47
  email:
38
48
  - support@pessetto.com
@@ -42,7 +52,6 @@ extra_rdoc_files: []
42
52
  files:
43
53
  - lib/dynamic_menu/base.rb
44
54
  - lib/dynamic_menu/inheritable_menus.rb
45
- - lib/dynamic_menu/user_grabber.rb
46
55
  - lib/dynamic_menu/version.rb
47
56
  - lib/dynamic_menu.rb
48
57
  - lib/engine.rb
@@ -133,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
142
  version: 1.3.1
134
143
  requirements: []
135
144
  rubyforge_project:
136
- rubygems_version: 1.8.11
145
+ rubygems_version: 1.8.24
137
146
  signing_key:
138
147
  specification_version: 3
139
148
  summary: Dynamic_menu is a gem aimed at making menus more DRY with inheritance.
@@ -1,9 +0,0 @@
1
- module DynamicMenu
2
- module UserGrabber
3
-
4
- def authorize_menus!
5
- @current_user = current_user
6
- end
7
-
8
- end
9
- end