navlinks 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/navlinks/helper.rb +15 -13
- data/lib/navlinks.rb +4 -1
- metadata +2 -2
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ Jeweler::Tasks.new do |gem|
|
|
6
6
|
gem.summary = "Very light-weight navigation"
|
7
7
|
|
8
8
|
gem.email = "ratnikov@gmail.com"
|
9
|
-
gem.homepage = "http://github.com/
|
9
|
+
gem.homepage = "http://github.com/ratnikov/navlinks"
|
10
10
|
gem.authors = [ "Dmitry Ratnikov" ]
|
11
11
|
gem.files = FileList["[A-Z]*", "{lib}/**/*"]
|
12
12
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/navlinks/helper.rb
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
# Methods added to this helper will be available to all templates in the application.
|
2
|
-
module Navlinks
|
3
|
-
|
2
|
+
module Navlinks
|
3
|
+
module Helper
|
4
|
+
attr_accessor :nav_area
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
def nav_link_to area, path, options = nil
|
7
|
+
label = translate(area, :scope => 'navigation', :default => area.to_s)
|
8
|
+
current_label = translate([ area, 'current' ].join('_'), :scope => 'navigation', :default => label)
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
if nav_area == area
|
11
|
+
link_to(decorate_current(current_label), path, :class => 'current')
|
12
|
+
else
|
13
|
+
link_to(label, path)
|
14
|
+
end
|
13
15
|
end
|
14
|
-
end
|
15
16
|
|
16
|
-
|
17
|
+
private
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
def decorate_current( current_label )
|
20
|
+
"[ #{current_label} ]"
|
21
|
+
end
|
20
22
|
end
|
21
23
|
end
|
data/lib/navlinks.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: navlinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Ratnikov
|
@@ -28,7 +28,7 @@ files:
|
|
28
28
|
- lib/navlinks.rb
|
29
29
|
- lib/navlinks/helper.rb
|
30
30
|
has_rdoc: true
|
31
|
-
homepage: http://github.com/
|
31
|
+
homepage: http://github.com/ratnikov/navlinks
|
32
32
|
licenses: []
|
33
33
|
|
34
34
|
post_install_message:
|