dynamic_menu 3.0.0.pre1 → 3.0.0.pre2

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