tida_template 0.2.8 → 0.2.9

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.
@@ -45,8 +45,7 @@ module TidaTemplate #:nodoc:
45
45
  copy_file 'app/views/shared/components/_toolbar.html.erb', 'app/views/shared/components/_toolbar.html.erb'
46
46
 
47
47
  # copy renders
48
- copy_file 'renderers/sub_navigation_bar_renderer.rb', 'lib/tida/renderers/sub_navigation_bar_renderer.rb'
49
- copy_file 'renderers/top_navigation_bar_renderer.rb', 'lib/tida/renderers/top_navigation_bar_renderer.rb'
48
+ copy_file 'renderers/navigation_bar_renderer.rb', 'lib/tida/renderers/navigation_bar_renderer.rb'
50
49
  copy_file 'renderers/component_renderer.rb', 'lib/tida/renderers/component_renderer.rb'
51
50
 
52
51
  # copy paperclip attachment access token
@@ -1,2 +1 @@
1
- SimpleNavigation.register_renderer :top_navigation_bar => ::Tida::Renderers::TopNavigationBarRenderer
2
- SimpleNavigation.register_renderer :sub_navigation_bar => ::Tida::Renderers::SubNavigationBarRenderer
1
+ SimpleNavigation.register_renderer :navigation_bar => ::Tida::Renderers::NavigationBarRenderer
@@ -1,6 +1,6 @@
1
1
  module Tida
2
2
  module Renderers
3
- class TopNavigationBarRenderer < ::SimpleNavigation::Renderer::Base
3
+ class NavigationBarRenderer < ::SimpleNavigation::Renderer::Base
4
4
  def render(item_container)
5
5
  list_content = item_container.items.inject([]) do |list, item|
6
6
  list << item_content(item)
@@ -51,10 +51,11 @@ module Tida
51
51
  content = []
52
52
  content << content_tag(:i, nil, class: icon) if icon
53
53
  content << content_tag(:span, item.name)
54
- content << content_tag(:i, nil, class: 'arrow icon-angle-left')
55
54
  if options[:class] && options[:class].include?('active')
56
- options[:class] = [options[:class], 'accordion-toggle'].flatten.compact.join(' ')
55
+ content << content_tag(:i, nil, class: 'arrow icon-angle-down')
56
+ options[:class] = [options[:class].delete('active'), 'accordion-toggle open'].flatten.compact.join(' ')
57
57
  else
58
+ content << content_tag(:i, nil, class: 'arrow icon-angle-left')
58
59
  options[:class] = [options[:class], 'accordion-toggle collapsed'].flatten.compact.join(' ')
59
60
  end
60
61
  options = options.merge('data-toggle' => "collapse", 'data-parent' => "#accordion_#{item.key}")
@@ -71,7 +72,12 @@ module Tida
71
72
  content << content_tag(:i, nil, class: icon) if icon
72
73
  content << content_tag(:span, sub_item.name)
73
74
  li_content = link_to(content.join(' '), sub_item.url, options)
74
- list << content_tag(:li, li_content)
75
+
76
+ if include_sub_navigation?(sub_item)
77
+ list << render_sub_navigation(sub_item)
78
+ else
79
+ list << content_tag(:li, li_content)
80
+ end
75
81
  end.join
76
82
  sub_list = content_tag(:ul, sub_list_content)
77
83
  inner_container = content_tag(:div, sub_list, class: 'accordion-inner')
@@ -1,3 +1,3 @@
1
1
  module TidaTemplate
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -94,7 +94,7 @@ $caret-size: 4px;
94
94
  }
95
95
  }
96
96
 
97
- .accordion .accordion {
97
+ .accordion .accordion .accordion-body {
98
98
  background: darken($topNavigationBackgroundColor, 10%);
99
99
  }
100
100
 
@@ -102,6 +102,18 @@ $caret-size: 4px;
102
102
  background: darken($topNavigationBackgroundColor, 5%);
103
103
  }
104
104
 
105
+ .accordion .accordion .accordion-heading, .accordion .accordion-inner {
106
+ a {
107
+ padding-left: 15px;
108
+ }
109
+ }
110
+
111
+ .accordion .accordion .accordion-inner {
112
+ a {
113
+ padding-left: 30px;
114
+ }
115
+ }
116
+
105
117
  .arrow {
106
118
  position: absolute;
107
119
  right: 10px;
@@ -120,125 +132,3 @@ $caret-size: 4px;
120
132
  }
121
133
  }
122
134
  }
123
-
124
- @mixin sub-navigation-active-state {
125
- background: $pageMenuActiveBackgroundColor;
126
- color: $pageMenuActiveForeColor;
127
- font-weight: bold;
128
- }
129
-
130
- @mixin sub-navigation-hover-state {
131
- background: $pageMenuHoverBackgroundColor;
132
- color: $pageMenuHoverForeColor;
133
- text-decoration: none !important;
134
- }
135
-
136
- #sub-navigation-bar {
137
- display: none;
138
- position: absolute;
139
- top: 0px; bottom: 0px;
140
- left: 0px; width: 199px;
141
- @include no-space;
142
- background: $pageMenuBackgroundColor;
143
- border-right: 1px solid $pageMenuBorderColor;
144
- z-index: 90;
145
-
146
- [class*="accordion"] {
147
- @include no-space;
148
- border: none;
149
- list-style: none;
150
- }
151
-
152
- .accordion {
153
- ul {
154
- list-style: none;
155
- @include no-space;
156
- }
157
-
158
- a {
159
- display: block;
160
- line-height: 30px;
161
- height: 30px;
162
- border-bottom: 1px solid $pageMenuBorderColor;
163
- padding: $smallPadding $bigPadding;
164
- font: {
165
- size: 12px;
166
- }
167
- color: $pageMenuForeColor;
168
-
169
- &:hover {
170
- @include sub-navigation-hover-state;
171
-
172
- .caret {
173
- @include caret-down($pageMenuHoverForeColor, $caret-size);
174
- }
175
-
176
- &.accordion-toggle.collapsed {
177
- .caret {
178
- @include caret-up($pageMenuHoverForeColor, $caret-size);
179
- }
180
- }
181
- }
182
-
183
- &.active {
184
- @include sub-navigation-active-state;
185
-
186
- &.in {
187
- background: $pageMenuBackgroundColor;
188
- color: $pageMenuForeColor;
189
-
190
- &:hover {
191
- background: $pageMenuHoverBackgroundColor;
192
- color: $pageMenuHoverForeColor;
193
-
194
- .caret {
195
- @include caret-down($pageMenuHoverForeColor, $caret-size);
196
- }
197
-
198
- &.accordion-toggle.collapsed {
199
- .caret {
200
- @include caret-up($pageMenuHoverForeColor, $caret-size);
201
- }
202
- }
203
- }
204
- }
205
-
206
- .caret {
207
- @include caret-down;
208
- }
209
-
210
- &.accordion-toggle.collapsed {
211
- .caret {
212
- @include caret-up;
213
- }
214
- }
215
- }
216
-
217
- .caret {
218
- position: relative;
219
- top: $normalPadding;
220
- @include caret-down;
221
- }
222
-
223
- &.accordion-toggle.collapsed {
224
- .caret {
225
- @include caret-up;
226
- }
227
- }
228
- }
229
- }
230
-
231
- .accordion-body {
232
- a {
233
- padding: 0px $bigPadding * 2;
234
- height: 35px;
235
- line-height: 35px;
236
-
237
- &.active {
238
- background: $pageMenuActiveBackgroundColor;
239
- color: $pageMenuActiveForeColor;
240
- font-weight: bold;
241
- }
242
- }
243
- }
244
- }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tida_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
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-09-15 00:00:00.000000000 Z
12
+ date: 2013-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -301,8 +301,7 @@ files:
301
301
  - lib/generators/tida_template/templates/rails_templates/erb/scaffold/show.html.erb
302
302
  - lib/generators/tida_template/templates/rails_templates/rails/scaffold_controller/controller.rb
303
303
  - lib/generators/tida_template/templates/renderers/component_renderer.rb
304
- - lib/generators/tida_template/templates/renderers/sub_navigation_bar_renderer.rb
305
- - lib/generators/tida_template/templates/renderers/top_navigation_bar_renderer.rb
304
+ - lib/generators/tida_template/templates/renderers/navigation_bar_renderer.rb
306
305
  - lib/generators/tida_template/templates/settingslogic/settings.rb
307
306
  - lib/tasks/tida_template_tasks.rake
308
307
  - lib/tida_template/engine.rb
@@ -379,7 +378,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
379
378
  version: '0'
380
379
  segments:
381
380
  - 0
382
- hash: -1478045781893974252
381
+ hash: -1506053846429571818
383
382
  required_rubygems_version: !ruby/object:Gem::Requirement
384
383
  none: false
385
384
  requirements:
@@ -388,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
388
387
  version: '0'
389
388
  segments:
390
389
  - 0
391
- hash: -1478045781893974252
390
+ hash: -1506053846429571818
392
391
  requirements: []
393
392
  rubyforge_project:
394
393
  rubygems_version: 1.8.25
@@ -1,70 +0,0 @@
1
- module Tida
2
- module Renderers
3
- class SubNavigationBarRenderer < ::SimpleNavigation::Renderer::Base
4
- def render(item_container)
5
- # header_content = content_tag :div, content_tag(:h3, item_container.selected_item ? item_container.selected_item.name : item_container.items.first.name), class: 'header'
6
- list_content = []
7
- if item_container.selected_item && include_sub_navigation?(item_container.selected_item)
8
- list_content = item_container.selected_item.sub_navigation.items.inject([]) do |list, item|
9
- Rails.logger.debug include_sub_navigation?(item)
10
- content = []
11
- content << tag_for_level_1(item)
12
- content << tag_for_level_2(item) if include_sub_navigation?(item)
13
- list << content_tag(:li, content_tag(:div, content.join, {class: 'accordion-group'}))
14
- end
15
- end
16
- menu_content = content_tag(:ul, list_content.join, {class: 'accordion'})
17
- div_content = []
18
- content_tag(:div, menu_content, {id: 'sub-navigation-bar'})
19
- end
20
-
21
- protected
22
-
23
- def tag_for_level_1(item)
24
- item_content = nil
25
- options = options_for(item)
26
- icon = options.delete(:icon)
27
- if suppress_link?(item)
28
- content = []
29
- content << content_tag(:i, nil, class: icon) if icon
30
- content << content_tag(:span, item.name)
31
- content << content_tag(:b, nil, class: 'caret')
32
- if options[:class] && options[:class].include?('active')
33
- options[:class] = [options[:class], 'accordion-toggle in'].flatten.compact.join(' ')
34
- else
35
- options[:class] = [options[:class], 'accordion-toggle collapsed'].flatten.compact.join(' ')
36
- end
37
- options = options.merge('data-toggle' => "collapse", 'data-parent' => "#page-menu")
38
- item_content = link_to(content.join(' '), "#collapse_#{item.key}", options)
39
- else
40
- options[:class] = [options[:class], 'accordion-toggle'].flatten.compact.join(' ')
41
- content = []
42
- content << content_tag(:i, nil, class: icon) if icon
43
- content << content_tag(:span, item.name)
44
- item_content = link_to(content.join(' '), item.url, options)
45
- end
46
- li_content = content_tag :div, item_content, class: 'accordion-heading'
47
- end
48
-
49
- def tag_for_level_2(item)
50
- Rails.logger.debug "sub_navigation"
51
- sub_list_content = item.sub_navigation.items.inject([]) do |list, sub_item|
52
- options = link_options_for(sub_item)
53
- icon = options.delete(:icon)
54
- content = []
55
- content << content_tag(:i, nil, class: icon) if icon
56
- content << content_tag(:span, sub_item.name)
57
- li_content = link_to(content.join(' '), sub_item.url, options)
58
- list << content_tag(:li, li_content)
59
- end.join
60
- sub_list = content_tag(:ul, sub_list_content)
61
- inner_container = content_tag(:div, sub_list, class: 'accordion-inner')
62
- if item.selected?
63
- content_tag(:div, inner_container, {:class => 'accordion-body in collapse active', 'id' => "collapse_#{item.key}"})
64
- else
65
- content_tag(:div, inner_container, {:class => 'accordion-body collapse', 'id' => "collapse_#{item.key}"})
66
- end
67
- end
68
- end
69
- end
70
- end