navigasmic 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
@@ -28,14 +28,14 @@ module Navigasmic
28
28
 
29
29
  options[:html] ||= {}
30
30
  options[:html][:class] = template.add_class(options[:html][:class], @@classnames[:with_group])
31
- options[:html][:id] ||= label.to_s.gsub(/\s/, '_').underscore
31
+ options[:html][:id] ||= label.to_s.gsub(/\s/, '_').underscore unless label.blank?
32
32
 
33
33
  buffer = template.capture(self, &proc)
34
34
  group = template.content_tag(@@group_tag, buffer)
35
35
  label = label_for_group(label) unless label.blank?
36
36
 
37
37
  visible = options[:hidden_unless].nil? ? true : options[:hidden_unless].is_a?(Proc) ? template.instance_eval(&options[:hidden_unless]) : options[:hidden_unless]
38
- visible ? template.content_tag(@@item_tag, label.to_s + group, options.delete(:html)) : ''
38
+ visible ? template.content_tag(@@item_tag, (label.to_s + group).html_safe, options.delete(:html)) : ''
39
39
  end
40
40
 
41
41
  def item(label, options = {}, &proc)
data/lib/navigasmic.rb CHANGED
@@ -75,7 +75,7 @@ module Navigasmic #:nodoc:
75
75
  @disabled_conditions = options[:disabled_if] || proc { false }
76
76
  @visible = options[:hidden_unless].nil? ? true : options[:hidden_unless].is_a?(Proc) ? template.instance_eval(&options[:hidden_unless]) : options[:hidden_unless]
77
77
 
78
- options[:highlights_on] = [options[:highlights_on]] if options[:highlights_on].kind_of?(Hash)
78
+ options[:highlights_on] = [options[:highlights_on]] if options[:highlights_on].kind_of?(Hash) || options[:highlights_on].kind_of?(String)
79
79
  @highlights_on = options[:highlights_on] || []
80
80
  @highlights_on << @link if link?
81
81
  end
@@ -103,9 +103,11 @@ module Navigasmic #:nodoc:
103
103
  when String
104
104
  highlighted &= path == highlight
105
105
  when Proc
106
- h = template.instance_evel(highlight)
106
+ h = template.instance_eval(highlight)
107
107
  raise 'proc highlighting rules must evaluate to TrueClass or FalseClass' unless (h.is_a?(TrueClass) || h.is_a?(FalseClass))
108
108
  highlighted &= h
109
+ when Regexp
110
+ highlighted &= path.match(highlight)
109
111
  when Hash
110
112
  h = clean_unwanted_keys(highlight)
111
113
  h.each_key do |key|
@@ -114,7 +116,7 @@ module Navigasmic #:nodoc:
114
116
  highlighted &= h_key == params[key].to_s
115
117
  end
116
118
  else
117
- raise 'highlighting rules should be a String, Proc or a Hash'
119
+ raise 'highlighting rules should be a String, Proc, Regexp or a Hash'
118
120
  end
119
121
 
120
122
  result |= highlighted
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.5.3"
8
+ s.version = "0.5.4"
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-12-15}
12
+ s.date = %q{2011-01-03}
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,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigasmic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 3
10
- version: 0.5.3
9
+ - 4
10
+ version: 0.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeremy Jackson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-15 00:00:00 -07:00
18
+ date: 2011-01-03 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency