radiant-navigation_tags-extension 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ module NavigationTags
7
7
  desc %{Render a navigation menu. Walks down the directory tree, expanding the tree up to the current page.
8
8
 
9
9
  *Usage:*
10
- <pre><code><r:nav [id="subnav"] [root=\"/products\"] [append_urls=\"/,/about-us/contact\"] [depth=\"2\"] [expand_all=\"true\"]/></code></pre>
10
+ <pre><code><r:nav [id="subnav"] [root=\"/products\"] [append_urls=\"/,/about-us/contact\"] [labels=\"/:Home,/about-us/contact:Contact us\"] [depth=\"2\"] [expand_all=\"true\"]/></code></pre>
11
11
  *Attributes:*
12
12
 
13
13
  root: defaults to "/", where to start building the navigation from, you can i.e. use "/products" to build a subnav
@@ -16,6 +16,7 @@ module NavigationTags
16
16
  ids_for_lis: defaults to false, enable this to give each li an id (it's slug prefixed with nav_)
17
17
  ids_for_links: defaults to false, enable this to give each link an id (it's slug prefixed with nav_)
18
18
 
19
+ labels: defaults to nil, use to overwrite the link text for given pages, otherwise the breadcrumb is used.
19
20
  depth: defaults to 1, which means no sub-ul's, set to 2 or more for a nested list
20
21
  expand_all: defaults to false, enable this to have all li's create sub-ul's of their children, i.o. only the currently active li
21
22
  id, class,..: go as html attributes of the outer ul
@@ -25,7 +26,7 @@ module NavigationTags
25
26
  if tag.double?
26
27
  root = Page.find_by_path(tag.expand)
27
28
  elsif defined?(Globalize2Extension) && Globalize2Extension.locales.size <= 1
28
- root = Page.find_by_path(root_url = tag.attr.delete('root') || "/#{I18n.locale}")
29
+ root = Page.find_by_path(root_url = tag.attr.delete('root') || "/#{I18n.locale}/")
29
30
  else
30
31
  root = Page.find_by_path(root_url = tag.attr.delete('root') || "/")
31
32
  end
@@ -33,7 +34,7 @@ module NavigationTags
33
34
  raise NavTagError, "No page found at \"#{root_url}\" to build navigation from." if root.class_name.eql?('FileNotFoundPage')
34
35
 
35
36
  depth = tag.attr.delete('depth') || 1
36
- ['ids_for_lis', 'ids_for_links', 'expand_all', 'first_set', 'prepend_urls', 'append_urls'].each do |prop|
37
+ ['ids_for_lis', 'ids_for_links', 'expand_all', 'first_set', 'prepend_urls', 'append_urls', 'labels'].each do |prop|
37
38
  eval "@#{prop} = tag.attr.delete('#{prop}') || false"
38
39
  end
39
40
 
@@ -122,9 +123,18 @@ module NavigationTags
122
123
 
123
124
  def link_for_page page
124
125
  if @ids_for_links
125
- "<a href=\"#{page.url}\" id=\"#{("link_" + (page.slug == "/" ? 'home' : page.slug))}\">#{escape_once(page.breadcrumb)}</a>"
126
+ "<a href=\"#{page.url}\" id=\"#{("link_" + (page.slug == "/" ? 'home' : page.slug))}\">#{label_for_page(page)}</a>"
126
127
  else
127
- "<a href=\"#{page.url}\">#{escape_once(page.breadcrumb)}</a>"
128
+ "<a href=\"#{page.url}\">#{label_for_page(page)}</a>"
129
+ end
130
+ end
131
+
132
+ def label_for_page page
133
+ # labels="/:Home,/portfolio:Our work"
134
+ if @labels && matched_label = @labels.split(',').select{|l| l.split(':').first == page.path}.first.split(":").last
135
+ escape_once(matched_label)
136
+ else
137
+ escape_once(page.breadcrumb)
128
138
  end
129
139
  end
130
140
 
@@ -0,0 +1,8 @@
1
+ module NavigationTagsExtension
2
+ VERSION = '0.2.4'
3
+ AUTHORS = ['Benny Degezelle', 'Marty Haught', 'Ryan Heneise']
4
+ EMAIL = 'benny@gorilla-webdesign.be'
5
+ URL = "https://github.com/jomz/navigation_tags"
6
+ SUMMARY = "Makes building navigations much easier."
7
+ DESCRIPTION = "Makes building navigations much easier."
8
+ end
@@ -1,7 +1,8 @@
1
+ require "navigation_tags_extension"
1
2
  class NavigationTagsExtension < Radiant::Extension
2
- version "2.3"
3
- description "Makes building navigations much easier."
4
- url "https://github.com/jomz/navigation_tags"
3
+ version NavigationTagsExtension::VERSION
4
+ description NavigationTagsExtension::DESCRIPTION
5
+ url NavigationTagsExtension::URL
5
6
 
6
7
  def activate
7
8
  Page.send :include, NavigationTags
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "navigation_tags_extension"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "radiant-navigation_tags-extension"
7
+ s.version = NavigationTagsExtension::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = NavigationTagsExtension::AUTHORS
10
+ s.email = NavigationTagsExtension::EMAIL
11
+ s.homepage = NavigationTagsExtension::URL
12
+ s.summary = NavigationTagsExtension::SUMMARY
13
+ s.description = NavigationTagsExtension::DESCRIPTION
14
+
15
+ ignores = if File.exist?('.gitignore')
16
+ File.read('.gitignore').split("\n").inject([]) {|a,p| a + Dir[p] }
17
+ else
18
+ []
19
+ end
20
+ s.files = Dir['**/*'] - ignores
21
+ s.test_files = Dir['test/**/*','spec/**/*','features/**/*'] - ignores
22
+ # s.executables = Dir['bin/*'] - ignores
23
+ s.require_paths = ["lib"]
24
+ end
metadata CHANGED
@@ -1,88 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: radiant-navigation_tags-extension
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 3
10
- version: 0.2.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Benny Degezelle
9
+ - Marty Haught
10
+ - Ryan Heneise
14
11
  autorequire:
15
12
  bindir: bin
16
13
  cert_chain: []
17
-
18
- date: 2011-06-24 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: radiant
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 57
29
- segments:
30
- - 0
31
- - 9
32
- - 1
33
- version: 0.9.1
34
- type: :runtime
35
- version_requirements: *id001
36
- description: Adds r:nav, a versatile navigation building tag to Radiant CMS
14
+ date: 2011-12-07 00:00:00.000000000Z
15
+ dependencies: []
16
+ description: Makes building navigations much easier.
37
17
  email: benny@gorilla-webdesign.be
38
18
  executables: []
39
-
40
19
  extensions: []
41
-
42
- extra_rdoc_files:
43
- - LICENSE
44
- - README
45
- files:
20
+ extra_rdoc_files: []
21
+ files:
46
22
  - CHANGELOG
47
- - LICENSE
48
- - README
49
- - Rakefile
50
- - VERSION
51
23
  - lib/navigation_tags.rb
24
+ - lib/navigation_tags_extension.rb
52
25
  - lib/tasks/navigation_tags_extension_tasks.rake
26
+ - LICENSE
53
27
  - navigation_tags_extension.rb
28
+ - radiant-navigations_tags-extension.gemspec
29
+ - Rakefile
30
+ - README
54
31
  homepage: https://github.com/jomz/navigation_tags
55
32
  licenses: []
56
-
57
33
  post_install_message:
58
34
  rdoc_options: []
59
-
60
- require_paths:
35
+ require_paths:
61
36
  - lib
62
- required_ruby_version: !ruby/object:Gem::Requirement
37
+ required_ruby_version: !ruby/object:Gem::Requirement
63
38
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
44
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
80
49
  requirements: []
81
-
82
50
  rubyforge_project:
83
- rubygems_version: 1.8.5
51
+ rubygems_version: 1.8.10
84
52
  signing_key:
85
53
  specification_version: 3
86
- summary: Navigation tags extension for Radiant CMS
54
+ summary: Makes building navigations much easier.
87
55
  test_files: []
88
-
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.3