simple_navigation 1.4.4 → 1.4.5
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.tar.gz.sig +0 -0
- data/Rakefile +1 -1
- data/lib/simple_navigation.rb +12 -8
- data/simple_navigation.gemspec +2 -2
- metadata +4 -4
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('simple_navigation', '1.4.
|
5
|
+
Echoe.new('simple_navigation', '1.4.5') do |e|
|
6
6
|
e.description = "Simple navigation menu gem for Ruby on Rails"
|
7
7
|
e.url = "http://github.com/mexpolk/simple_navigation"
|
8
8
|
e.author = "Ivan Torres"
|
data/lib/simple_navigation.rb
CHANGED
@@ -3,10 +3,10 @@ module SimpleNavigation
|
|
3
3
|
# Simple Navigation helper methods module
|
4
4
|
module Helper
|
5
5
|
|
6
|
-
attr_accessor :current_menu_id
|
6
|
+
attr_accessor :current_menu_id, :custom_titles
|
7
7
|
|
8
8
|
# Renders simple navigation menu by key name
|
9
|
-
def simple_navigation(name)
|
9
|
+
def simple_navigation(name, options = {})
|
10
10
|
|
11
11
|
# Load navigation hash
|
12
12
|
navigation = SimpleNavigation::Builder.navigation[name.to_sym]
|
@@ -14,14 +14,16 @@ module SimpleNavigation
|
|
14
14
|
# Reset current menu
|
15
15
|
self.current_menu_id = nil
|
16
16
|
|
17
|
-
|
18
|
-
:id
|
19
|
-
:class
|
17
|
+
settings = {
|
18
|
+
:id => navigation[:id],
|
19
|
+
:class => options[:class] || 'simple_navigation',
|
20
20
|
}
|
21
21
|
|
22
|
+
self.custom_titles = options[:custom_titles] || {}
|
23
|
+
|
22
24
|
# Set CSS class that user may added
|
23
25
|
if navigation.has_key?(:options) && navigation[:options].has_key?(:class)
|
24
|
-
|
26
|
+
settings[:class] << " #{navigation[:options][:class]}"
|
25
27
|
end
|
26
28
|
|
27
29
|
# Render root menus
|
@@ -34,7 +36,7 @@ module SimpleNavigation
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
content_tag(:ul, menus || '',
|
39
|
+
content_tag(:ul, menus || '', settings)
|
38
40
|
|
39
41
|
end # simple_navigation(name)
|
40
42
|
|
@@ -83,7 +85,9 @@ module SimpleNavigation
|
|
83
85
|
# * If menu hash +:title+ key is not present then it formats +:name+ key as titleized string
|
84
86
|
# * If menu hash +:title+ key is not present and i18n is turned on, then it will use +:name+ key as translation key
|
85
87
|
def render_menu_title(menu)
|
86
|
-
title = if
|
88
|
+
title = if self.custom_titles.has_key?(menu[:id])
|
89
|
+
self.custom_titles[menu[:id]]
|
90
|
+
elsif menu.has_key?(:title)
|
87
91
|
menu[:title]
|
88
92
|
else
|
89
93
|
if menu[:options][:i18n]
|
data/simple_navigation.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{simple_navigation}
|
5
|
-
s.version = "1.4.
|
5
|
+
s.version = "1.4.5"
|
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"]
|
9
9
|
s.cert_chain = ["/Users/ivan/.ssh/gem-public_cert.pem"]
|
10
|
-
s.date = %q{2010-
|
10
|
+
s.date = %q{2010-11-05}
|
11
11
|
s.description = %q{Simple navigation menu gem for Ruby on Rails}
|
12
12
|
s.email = %q{mexpolk@gmail.com}
|
13
13
|
s.extra_rdoc_files = ["README.rdoc", "lib/simple_navigation.rb"]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_navigation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 5
|
10
|
+
version: 1.4.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ivan Torres
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
MKLC1g==
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date: 2010-
|
39
|
+
date: 2010-11-05 00:00:00 -06:00
|
40
40
|
default_executable:
|
41
41
|
dependencies: []
|
42
42
|
|
metadata.gz.sig
CHANGED
Binary file
|