innetra-easy_navigation 1.0.0 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -29,31 +29,23 @@ this:
29
29
  tab.menu :index, :url => { :controller => "dashboard", :action => "index" } do |menu|
30
30
  menu.connect :except => "new" # if :controller not specified it asumes is the same from tab
31
31
  end
32
- end
33
- navigation.tab :post, :url => { :controller => "posts", :action => "index" } do |tab|
34
- tab.menu :index, :url => { :controller => "posts", :action => "index" } do |menu|
35
- menu.connect :except => "new"
36
- end
37
- tab.menu :new, :url => { :controller => "posts", :action => "new" } do |menu|
32
+ tab.menu :new, :url => { :controller => "dashboard", :action => "index" } do |menu|
38
33
  menu.connect :only => "new"
39
34
  end
40
- tab.menu :rss, :url => { :controller => "post_rss", :action => "atom" } do |menu|
41
- menu.connect :only => "show"
42
- end
43
35
  end
44
36
  end
45
37
  end
46
38
 
47
39
  For internationalization, edit your "en-US.easy_navigation.yml" file lique this:
48
40
 
49
- en-US:
50
- easy_navigation:
51
- default:
52
- home:
53
- title: "Home"
54
- menus:
55
- index: "Dashboard"
56
- new: "New Page"
41
+ en-US:
42
+ easy_navigation:
43
+ default:
44
+ home:
45
+ title: "Home"
46
+ menus:
47
+ index: "Dashboard"
48
+ new: "New Page"
57
49
 
58
50
 
59
51
  As an example, to render you newly created menu called :default in your
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('easy_navigation', '1.0.0') do |e|
5
+ Echoe.new('easy_navigation', '1.0.8') do |e|
6
6
  e.description = "Easy navigation for ruby on rails 2.2 (i18n)"
7
7
  e.url = "http://github.com/innetra/easy_navigation"
8
8
  e.author = "Ivan Torres"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{easy_navigation}
5
- s.version = "1.0.0"
5
+ s.version = "1.0.8"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ivan Torres"]
@@ -90,17 +90,16 @@ module EasyNavigation
90
90
 
91
91
  class Navigation
92
92
 
93
- attr_accessor :tabs, :name, :options, :prefix
93
+ attr_accessor :tabs, :name, :options
94
94
 
95
95
  def initialize(name, options = {})
96
96
  self.tabs = []
97
97
  self.name = name
98
98
  self.options = options
99
- self.prefix = options[:prefix]
100
99
  end
101
100
 
102
101
  def tab(name, options = {}, &block)
103
- tab = Tab.new(name, options.merge!(:prefix => [self.prefix, self.name]))
102
+ tab = Tab.new(name, options.merge!(:prefix => [self.options[:prefix], self.name]))
104
103
  yield tab
105
104
  self.tabs << tab.build
106
105
  end
@@ -112,47 +111,43 @@ module EasyNavigation
112
111
 
113
112
  class Tab
114
113
 
115
- attr_accessor :menus, :name, :url, :options, :prefix
114
+ attr_accessor :menus, :name, :options
116
115
 
117
116
  def initialize(name, options = {})
118
117
  self.menus = []
119
118
  self.name = name
120
- self.url = options[:url]
121
119
  self.options = options
122
- self.prefix = options[:prefix]
123
120
  end
124
121
 
125
122
  def menu(name, options = {}, &block)
126
- menu = Menu.new(name, options.merge!(:prefix => [self.prefix, self.name, "menus"]))
123
+ menu = Menu.new(name, options.merge!(:prefix => [self.options[:prefix], self.name, "menus"]))
127
124
  yield menu
128
125
  self.menus << menu.build
129
126
  end
130
127
 
131
128
  def build
132
- { :name => [self.prefix, self.name].join("_").to_sym,
133
- :text => [self.prefix, self.name, "title"].join("."),
134
- :url => self.url,
129
+ { :name => [self.options[:prefix], self.name].join("_").to_sym,
130
+ :text => [self.options[:prefix], self.name, "title"].join("."),
131
+ :url => self.options[:url],
135
132
  :options => self.options,
136
133
  :menus => self.menus }
137
134
  end
138
135
 
139
136
  class Menu
140
137
 
141
- attr_accessor :name, :url, :options, :active_urls, :prefix
138
+ attr_accessor :name, :options, :active_urls
142
139
 
143
140
  def initialize(name, params = {})
144
141
  self.active_urls = []
145
142
  self.name = name
146
- self.url = params[:url]
147
143
  self.options = params
148
- self.prefix = params[:prefix]
149
144
  end
150
145
 
151
146
  def build
152
- self.prefix << self.name
153
- { :name => self.prefix.join("_").to_sym,
154
- :text => self.prefix.join("."),
155
- :url => self.url,
147
+ self.options[:prefix] << self.name
148
+ { :name => self.options[:prefix].join("_").to_sym,
149
+ :text => self.options[:prefix].join("."),
150
+ :url => self.options[:url],
156
151
  :on => self.active_urls }
157
152
  end
158
153
 
@@ -169,6 +164,6 @@ module EasyNavigation
169
164
 
170
165
  Builder = Configuration.new
171
166
 
172
- end# EasyNavigation
167
+ end # EasyNavigation
173
168
 
174
169
  ActionView::Base.send :include, EasyNavigation::Helper
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: innetra-easy_navigation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Torres