gretel 1.0.9 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/gretel/helper_methods.rb +15 -3
  2. metadata +4 -4
@@ -42,19 +42,31 @@ module Gretel
42
42
  if link_last
43
43
  out = link_to_if(link_last, crumb.link.text, crumb.link.url, crumb.link.options.merge(:class => "current"))
44
44
  else
45
- out = content_tag(:span, crumb.link.text, :class => "current")
45
+ if options[:use_microformat]
46
+ out = content_tag(:span, crumb.link.text, :class => "current", :itemprop => "title")
47
+ else
48
+ out = content_tag(:span, crumb.link.text, :class => "current")
49
+ end
46
50
  end
47
51
 
48
52
  while parent = crumb.parent
49
53
  last_parent = parent.name
50
54
  crumb = Crumbs.get_crumb(parent.name, parent.object)
51
- out = link_to(crumb.link.text, crumb.link.url, crumb.link.options) + " " + separator + " " + out
55
+ if options[:use_microformat]
56
+ out = content_tag(:div, link_to(content_tag(:span, crumb.link.text, :itemprop => "title"), crumb.link.url, crumb.link.options.merge(:itemprop => "url")) + " ", :itemscope => "", :itemtype => "http://data-vocabulary.org/Breadcrumb") + " " + separator + " " + out
57
+ else
58
+ out = link_to(crumb.link.text, crumb.link.url, crumb.link.options) + " " + separator + " " + out
59
+ end
52
60
  end
53
61
 
54
62
  # TODO: Refactor this
55
63
  if options[:autoroot] && name != :root && last_parent != :root
56
64
  crumb = Crumbs.get_crumb(:root)
57
- out = link_to(crumb.link.text, crumb.link.url, crumb.link.options) + " " + separator + " " + out
65
+ if options[:use_microformat]
66
+ out = content_tag(:div, link_to(content_tag(:span, crumb.link.text, :itemprop => "title"), crumb.link.url, crumb.link.options.merge(:itemprop => "url")) + " ", :itemscope => "", :itemtype => "http://data-vocabulary.org/Breadcrumb") + " " + separator + " " + out
67
+ else
68
+ out = link_to(crumb.link.text, crumb.link.url, crumb.link.options) + " " + separator + " " + out
69
+ end
58
70
  end
59
71
 
60
72
  out
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gretel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 9
10
- version: 1.0.9
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lasse Bunk
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-09 00:00:00 Z
18
+ date: 2012-05-21 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Gretel is a Ruby on Rails plugin that makes it easy yet flexible to create breadcrumbs.