makandra-navy 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/navy/renderer.rb CHANGED
@@ -76,7 +76,8 @@ module Navy
76
76
 
77
77
  def render_section(section, level, parent_id)
78
78
  id = next_id
79
- link_classes = ['navy-section']
79
+ link_to_options = section.link_to_options.dup
80
+ link_classes = ['navy-section', link_to_options.delete(:class)].compact
80
81
  link_classes << 'navy-current navy-active' if section.active?
81
82
  label = ''.html_safe
82
83
  if section.children?
@@ -88,7 +89,7 @@ module Navy
88
89
  end
89
90
  label << section.label
90
91
  label = content_tag(:span, label, :class => 'navy-section-inner')
91
- link_to(label, section.url, :class => link_classes.join(' '), :"data-navy-opens" => id, 'data-navy-section' => section.name)
92
+ link_to(label, section.url, link_to_options.merge(:class => link_classes.join(' '), :"data-navy-opens" => id, 'data-navy-section' => section.name))
92
93
  end
93
94
 
94
95
 
data/lib/navy/section.rb CHANGED
@@ -2,15 +2,16 @@ module Navy
2
2
  class Section
3
3
  include SectionContainer
4
4
 
5
- attr_reader :name, :label
5
+ attr_reader :name, :label, :link_to_options
6
6
  attr_accessor :url
7
7
 
8
- def initialize(name, label, url, active, &children)
8
+ def initialize(name, label, url, link_to_options, active, &children)
9
9
  @name = name
10
10
  @label = label
11
11
  @url = url
12
12
  @active = active
13
13
  @children = children
14
+ @link_to_options = link_to_options
14
15
  end
15
16
 
16
17
  def active?
@@ -13,8 +13,8 @@ module Navy
13
13
  self
14
14
  end
15
15
 
16
- def section(name, label, url = nil, &children)
17
- section = Navy::Section.new(name, label, url, @context.section_active?(name), &children)
16
+ def section(name, label, url = nil, link_to_options = {}, &children)
17
+ section = Navy::Section.new(name, label, url, link_to_options, @context.section_active?(name), &children)
18
18
  if url.nil?
19
19
  section.url = section.sections(@context).first.url
20
20
  end
data/lib/navy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Navy
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makandra-navy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tobias Kraze
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-06-11 00:00:00 +02:00
19
+ date: 2012-07-19 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -53,7 +53,6 @@ files:
53
53
  - lib/navy.rb
54
54
  - lib/navy/description.rb
55
55
  - lib/navy/navigation.rb
56
- - lib/navy/parser.rb
57
56
  - lib/navy/renderer.rb
58
57
  - lib/navy/renderer_helper.rb
59
58
  - lib/navy/section.rb
data/lib/navy/parser.rb DELETED
@@ -1,18 +0,0 @@
1
- module Navy
2
- module Parser
3
-
4
- def navigation(name, &children)
5
- navigation = Navy::Navigation.new(name, &children)
6
- singleton_class.send(:define_method, name) { navigation }
7
- end
8
-
9
- def section(name, label, url)
10
- sections << Navy::Section.new()
11
- end
12
-
13
- def sections
14
- @sections ||= []
15
- end
16
-
17
- end
18
- end