navigasmic 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -24,6 +24,7 @@ And then I wrote a DSL that met those requirements:
24
24
  <%= n.group 'Media' do %>
25
25
  <%= n.item 'Image Gallery', :link => '/media/images', :highlights_on => '/media/videos' %>
26
26
  <%= n.item 'Videos', :link => '/media/videos', :disabled_if => proc { true } %>
27
+ <%= n.item 'Contact Us' # auto links to the contact_us_path if it exists %>
27
28
  <% end %>
28
29
  <% end %>
29
30
  </pre>
@@ -215,7 +216,7 @@ RDoc documentation _should_ be automatically generated after each commit and mad
215
216
 
216
217
  h2. Compatibility
217
218
 
218
- I'm only testing with the latest Rails 2.4.x stable release, and it should work under Rails 2.3.x as well. Feel free to add backwards compatibility if you need it.
219
+ I'm only testing with the latest Rails 2.3.x stable release, and it should work under Rails 2.3.x as well. Feel free to add backwards compatibility if you need it.
219
220
 
220
221
  h2. Project Info
221
222
 
data/Rakefile CHANGED
@@ -13,6 +13,7 @@ begin
13
13
  gem.add_development_dependency "thoughtbot-shoulda"
14
14
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
15
  end
16
+ Jeweler::GemcutterTasks.new
16
17
  rescue LoadError
17
18
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
19
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.5
@@ -14,7 +14,7 @@ module Navigasmic
14
14
  attr_accessor :template, :name, :items
15
15
 
16
16
  def initialize(template, name, options = {}, &proc)
17
- @template, @name, @items = template, name.to_s, options, []
17
+ @template, @name, @items = template, name.to_s, []
18
18
  render(options.delete(:html), &proc)
19
19
  end
20
20
 
@@ -40,7 +40,7 @@ module Navigasmic
40
40
  def item(label, options = {}, &proc)
41
41
  buffer = block_given? ? template.capture(self, &proc) : ''
42
42
 
43
- item = NavigationItem.new(label, options)
43
+ item = NavigationItem.new(label, options, template)
44
44
 
45
45
  options[:html] ||= {}
46
46
  options[:html][:id] ||= label.to_s.gsub(/\s/, '_').underscore
@@ -10,7 +10,7 @@ module Navigasmic
10
10
  attr_accessor :template, :name, :items
11
11
 
12
12
  def initialize(template, name, options = {}, &proc)
13
- @template, @name, @items = template, name.to_s, options, []
13
+ @template, @name, @items = template, name.to_s, []
14
14
  render(options.delete(:html), &proc)
15
15
  end
16
16
 
@@ -36,7 +36,7 @@ module Navigasmic
36
36
  def item(label, options = {}, &proc)
37
37
  buffer = block_given? ? template.capture(self, &proc) : ''
38
38
 
39
- item = NavigationItem.new(label, options)
39
+ item = NavigationItem.new(label, options, template)
40
40
 
41
41
  options[:html] ||= {}
42
42
  options[:html][:id] ||= label.to_s.gsub(/\s/, '_').underscore
data/lib/navigasmic.rb CHANGED
@@ -36,7 +36,7 @@ module Navigasmic #:nodoc:
36
36
  raise ArgumentError, "Missing block" unless block_given?
37
37
 
38
38
  options = args.extract_options!
39
-
39
+
40
40
  options[:html] ||= {}
41
41
  options[:html][:class] = add_class(options[:html][:class], 'semantic-navigation')
42
42
  options[:html][:id] ||= name.to_s.underscore
@@ -51,7 +51,7 @@ module Navigasmic #:nodoc:
51
51
  end
52
52
 
53
53
  end
54
-
54
+
55
55
  #
56
56
  #
57
57
  #
@@ -61,9 +61,16 @@ module Navigasmic #:nodoc:
61
61
 
62
62
  attr_accessor :label, :link
63
63
 
64
- def initialize(label, options = {})
64
+ def initialize(label, options = {}, template = nil)
65
65
  @label = label
66
- @link = options[:link] || {}
66
+
67
+ if options[:link]
68
+ @link = options[:link]
69
+ elsif template.present?
70
+ method = "#{label.to_s.underscore.gsub(/\s/, '_')}_path"
71
+ @link = template.send(method) if template.respond_to? method
72
+ end
73
+ @link ||= {}
67
74
 
68
75
  @disabled_conditions = options[:disabled_if] || proc { false }
69
76
 
data/navigasmic.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{navigasmic}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jeremy Jackson"]
12
- s.date = %q{2010-01-09}
12
+ s.date = %q{2010-01-24}
13
13
  s.description = %q{Semantic navigation; a semantic way to build beautifully simple navigation structures in Rails.}
14
14
  s.email = %q{jejacks0n@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigasmic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Jackson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-09 00:00:00 -07:00
12
+ date: 2010-01-24 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency