conte_rails_template 0.0.33 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module ConteRailsTemplate
2
- VERSION = "0.0.33"
2
+ VERSION = "0.0.34"
3
3
  end
@@ -1,55 +1,55 @@
1
- module ConteRailsTemplate
2
- class NavigationRenderer < SimpleNavigation::Renderer::Base
3
- def render(item_container)
4
- if options[:is_subnavigation]
5
- ul_class = "child"
6
- else
7
- ul_class = "parent"
8
- end
9
-
10
- list_content = item_container.items.inject([]) do |list, item|
11
- li_options = item.html_options.reject {|k, v| k == :link}
12
- li_content = tag_for(item)
13
- if include_sub_navigation?(item)
14
- li_content << render_sub_navigation_for(item)
15
- end
16
- list << content_tag(:li, li_content, li_options)
17
- end.join
18
- if skip_if_empty? && item_container.empty?
19
- ''
20
- else
21
- content_tag(:ul, list_content, { :id => item_container.dom_id, :class => [item_container.dom_class, ul_class].flatten.compact.join(' ') })
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)
22
8
  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'}
23
15
  end
16
+ end
24
17
 
25
- def render_sub_navigation_for(item)
26
- item.sub_navigation.render(self.options.merge(:is_subnavigation => true))
27
- end
28
-
29
- protected
18
+ protected
30
19
 
31
- def tag_for(item)
32
- if item.url.nil?
33
- content_tag('span', item.name, link_options_for(item).except(:method))
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(' ')
34
29
  else
35
- link_content = item.name
36
- if item.url == "javascript:void(0);"
37
- link_content = "#{item.name}<b class=\"caret\"></b>"
38
- end
39
-
40
- link_to(link_content, item.url, link_options_for(item))
30
+ options[:class] = [options[:class], 'accordion-toggle collapsed'].flatten.compact.join(' ')
41
31
  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)
42
37
  end
38
+ content_tag :div, item_content, class: 'accordion-heading'
39
+ end
43
40
 
44
- # Extracts the options relevant for the generated link
45
- #
46
- def link_options_for(item)
47
- special_options = {:method => item.method}.reject {|k, v| v.nil? }
48
- link_options = item.html_options[:link] || {}
49
- opts = special_options.merge(link_options)
50
- opts[:class] = [link_options[:class], item.selected_class].flatten.compact.join(' ')
51
- opts.delete(:class) if opts[:class].nil? || opts[:class] == ''
52
- opts
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}"})
53
53
  end
54
54
  end
55
55
  end
@@ -56,67 +56,78 @@ body {
56
56
  width: 100%;
57
57
  text-shadow: 0px 1px 0px rgba(0, 0, 0, 1);
58
58
  z-index: 1;
59
- ul {
59
+
60
+ &.accordion {
60
61
  padding: 0px; margin: 0px;
61
- width: 100%;
62
62
 
63
- li {
64
- width: 100%;
65
- display: block;
66
- background: #3B3D43;
63
+ a {
64
+ color: #ccc;
65
+ font-weight: bold;
66
+ font-size: 16px;
67
+ padding: 0px; margin: 0px;
68
+ }
67
69
 
68
- & a:active, &.active a {
69
- background: #824365;
70
- }
70
+ .accordion-group {
71
+ border: none;
72
+ padding: 0px; margin: 0px;
71
73
 
72
- a {
73
- display: block;
74
- padding: 15px;
75
- color: #ccc;
76
- font-weight: bold;
77
- font-size: 16px;
78
- text-decoration: none;
74
+ .accordion-toggle {
75
+ height: 50px;
76
+ line-height: 50px;
79
77
  border-top: 1px solid rgba(255, 255, 255, 0.1);
80
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
78
+ border-bottom: 1px solid rgba(0, 0, 0, 0.2);
79
+ padding-left: 20px;
81
80
 
82
- &:hover {
83
- background: #484B51;
81
+ .caret {
82
+ border-top: none;
83
+ border-bottom: 6px solid #ccc;
84
+ border-left: 6px solid transparent;
85
+ border-right: 6px solid transparent;
86
+ margin-top: 20px;
84
87
  }
85
88
 
86
- &:active {
89
+ &.collapsed {
90
+ .caret {
91
+ border-bottom: none;
92
+ border-top: 6px solid #ccc;
93
+ }
94
+ }
95
+
96
+ &.active {
87
97
  background: #824365;
98
+ &:hover {
99
+ background: #824365;
100
+ }
88
101
  }
89
102
 
90
- .caret {
91
- border-top: 6px solid #ccc;
92
- border-right: 6px solid transparent;
93
- border-left: 6px solid transparent;
94
- margin: 7px 0px 0px 10px;
103
+ &:hover {
104
+ background: #484B51;
95
105
  }
96
106
  }
97
107
 
98
- &.toggle .caret {
99
- border-top: none;
100
- border-bottom: 6px solid #ccc;
101
- border-right: 6px solid transparent;
102
- border-left: 6px solid transparent;
103
- }
108
+ .accordion-inner {
109
+ border: none;
110
+ padding: 0px; margin: 0px;
104
111
 
105
- ul {
106
- background: #313237;
112
+ a {
113
+ border-top: none;
114
+ height: 50px;
115
+ padding: 0px;
116
+ line-height: 50px;
117
+ padding-left: 30px;
118
+
119
+ &.active {
120
+ background: #61324b;
121
+ }
107
122
 
108
- li {
109
- a {
110
- padding-left: 35px;
123
+ &:hover {
124
+ background: #484B51;
111
125
  }
112
126
  }
113
127
  }
114
128
  }
115
-
116
- li:first-child a {
117
- border-top: none;
118
- }
119
129
  }
130
+
120
131
  }
121
132
  }
122
133
 
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.33
4
+ version: 0.0.34
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-21 00:00:00.000000000 Z
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties