conte_rails_template 0.0.34 → 0.0.35

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ConteRailsTemplate
2
- VERSION = "0.0.34"
2
+ VERSION = "0.0.35"
3
3
  end
@@ -1,55 +1,57 @@
1
- class NavigationRenderer < SimpleNavigation::Renderer::Base
2
- def render(item_container)
3
- list_content = item_container.items.inject([]) do |list, item|
4
- li_content = []
5
- li_content << tag_for(item)
6
- if include_sub_navigation?(item)
7
- li_content << render_sub_navigation_for(item)
1
+ module ConteRailsTemplate
2
+ class NavigationRenderer < SimpleNavigation::Renderer::Base
3
+ def render(item_container)
4
+ list_content = item_container.items.inject([]) do |list, item|
5
+ li_content = []
6
+ li_content << tag_for(item)
7
+ if include_sub_navigation?(item)
8
+ li_content << render_sub_navigation_for(item)
9
+ end
10
+ list << content_tag(:div, li_content.join, class: 'accordion-group')
11
+ end.join
12
+ if skip_if_empty? && item_container.empty?
13
+ ''
14
+ else
15
+ content_tag :div, list_content, {:class => 'accordion', "id" => 'navigation'}
8
16
  end
9
- list << content_tag(:div, li_content.join, class: 'accordion-group')
10
- end.join
11
- if skip_if_empty? && item_container.empty?
12
- ''
13
- else
14
- content_tag :div, list_content, {:class => 'accordion', "id" => 'navigation'}
15
17
  end
16
- end
17
18
 
18
- protected
19
+ protected
19
20
 
20
- def tag_for(item)
21
- item_content = nil
22
- options = link_options_for(item)
23
- if suppress_link?(item)
24
- content = []
25
- content << item.name
26
- content << content_tag(:b, nil, class: 'caret')
27
- if options[:class] && options[:class].include?('active')
28
- options[:class] = [options[:class], 'accordion-toggle in'].flatten.compact.join(' ')
21
+ def tag_for(item)
22
+ item_content = nil
23
+ options = link_options_for(item)
24
+ if suppress_link?(item)
25
+ content = []
26
+ content << item.name
27
+ content << content_tag(:b, nil, class: 'caret')
28
+ if options[:class] && options[:class].include?('active')
29
+ options[:class] = [options[:class], 'accordion-toggle in'].flatten.compact.join(' ')
30
+ else
31
+ options[:class] = [options[:class], 'accordion-toggle collapsed'].flatten.compact.join(' ')
32
+ end
33
+ options = options.merge('data-toggle' => "collapse", 'data-parent' => "#navigation")
34
+ item_content = link_to(content.join(' '), "#collapse_#{item.key}", options)
29
35
  else
30
- options[:class] = [options[:class], 'accordion-toggle collapsed'].flatten.compact.join(' ')
36
+ options[:class] = [options[:class], 'accordion-toggle'].flatten.compact.join(' ')
37
+ item_content = link_to(item.name, item.url, options)
31
38
  end
32
- options = options.merge('data-toggle' => "collapse", 'data-parent' => "#navigation")
33
- item_content = link_to(content.join(' '), "#collapse_#{item.key}", options)
34
- else
35
- options[:class] = [options[:class], 'accordion-toggle'].flatten.compact.join(' ')
36
- item_content = link_to(item.name, item.url, options)
39
+ content_tag :div, item_content, class: 'accordion-heading'
37
40
  end
38
- content_tag :div, item_content, class: 'accordion-heading'
39
- end
40
41
 
41
- def render_sub_navigation_for(item)
42
- options = link_options_for(item)
43
- sub_list_content = item.sub_navigation.items.inject([]) do |list, sub_item|
44
- li_content = link_to(sub_item.name, sub_item.url, link_options_for(sub_item))
45
- list << content_tag(:li, li_content)
46
- end.join
47
- sub_list = content_tag(:ul, sub_list_content)
48
- inner_container = content_tag(:div, sub_list, class: 'accordion-inner')
49
- if options[:class] && options[:class].include?('active')
50
- content_tag(:div, inner_container, {:class => 'accordion-body in collapse', 'id' => "collapse_#{item.key}"})
51
- else
52
- content_tag(:div, inner_container, {:class => 'accordion-body collapse', 'id' => "collapse_#{item.key}"})
42
+ def render_sub_navigation_for(item)
43
+ options = link_options_for(item)
44
+ sub_list_content = item.sub_navigation.items.inject([]) do |list, sub_item|
45
+ li_content = link_to(sub_item.name, sub_item.url, link_options_for(sub_item))
46
+ list << content_tag(:li, li_content)
47
+ end.join
48
+ sub_list = content_tag(:ul, sub_list_content)
49
+ inner_container = content_tag(:div, sub_list, class: 'accordion-inner')
50
+ if options[:class] && options[:class].include?('active')
51
+ content_tag(:div, inner_container, {:class => 'accordion-body in collapse', 'id' => "collapse_#{item.key}"})
52
+ else
53
+ content_tag(:div, inner_container, {:class => 'accordion-body collapse', 'id' => "collapse_#{item.key}"})
54
+ end
53
55
  end
54
56
  end
55
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conte_rails_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34
4
+ version: 0.0.35
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: