tida_template 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,17 +2,20 @@ module Tida
2
2
  module Renderers
3
3
  class TopNavigationBarRenderer < ::SimpleNavigation::Renderer::Base
4
4
  def render(item_container)
5
- ul_content = item_container.items.inject([]) do |list, item|
5
+ list_content = item_container.items.inject([]) do |list, item|
6
6
  list << item_content(item)
7
7
  end.join
8
- div_content = content_tag :ul, ul_content
9
- content_tag(:div, div_content, {id: "top-navigation-bar"})
8
+ content_tag(:div, content_tag(:ul, list_content), {id: "top-navigation-bar"})
10
9
  end
11
10
 
12
11
  protected
13
12
 
14
13
  def item_content(item)
15
- content_tag :li, tag_for(item)
14
+ if include_sub_navigation?(item)
15
+ return render_sub_navigation(item)
16
+ else
17
+ return content_tag :li, tag_for(item)
18
+ end
16
19
  end
17
20
 
18
21
  def tag_for(item)
@@ -27,10 +30,56 @@ module Tida
27
30
  stack = content_tag(:span, stack_content.join(), class: 'icon-stack')
28
31
  content << stack
29
32
  else
30
- content << content_tag(:i, nil, class: "#{icon} icon-2x")
33
+ content << content_tag(:i, nil, class: icon)
31
34
  end
32
35
  content << content_tag(:span, item.name)
33
- link_to content.join('<br>'), item.url, options
36
+ link_to content.join(' '), item.url, options
37
+ end
38
+
39
+ def render_sub_navigation(parent_item)
40
+ content = []
41
+ content << tag_for_level_1(parent_item)
42
+ content << tag_for_level_2(parent_item)
43
+ content_tag :div, content_tag(:div, content.join(), class: 'accordion-group'), class: 'accordion', id: "accordion_#{parent_item.key}"
44
+ end
45
+
46
+ def tag_for_level_1(item)
47
+ item_content = nil
48
+ options = options_for(item)
49
+ icon = options.delete(:icon)
50
+
51
+ content = []
52
+ content << content_tag(:i, nil, class: icon) if icon
53
+ content << content_tag(:span, item.name)
54
+ content << content_tag(:i, nil, class: 'arrow icon-angle-left')
55
+ if options[:class] && options[:class].include?('active')
56
+ options[:class] = [options[:class], 'accordion-toggle'].flatten.compact.join(' ')
57
+ else
58
+ options[:class] = [options[:class], 'accordion-toggle collapsed'].flatten.compact.join(' ')
59
+ end
60
+ options = options.merge('data-toggle' => "collapse", 'data-parent' => "#accordion_#{item.key}")
61
+ item_content = link_to(content.join(' '), "#collapse_#{item.key}", options)
62
+
63
+ li_content = content_tag :div, item_content, class: 'accordion-heading'
64
+ end
65
+
66
+ def tag_for_level_2(item)
67
+ sub_list_content = item.sub_navigation.items.inject([]) do |list, sub_item|
68
+ options = link_options_for(sub_item)
69
+ icon = options.delete(:icon)
70
+ content = []
71
+ content << content_tag(:i, nil, class: icon) if icon
72
+ content << content_tag(:span, sub_item.name)
73
+ li_content = link_to(content.join(' '), sub_item.url, options)
74
+ list << content_tag(:li, li_content)
75
+ end.join
76
+ sub_list = content_tag(:ul, sub_list_content)
77
+ inner_container = content_tag(:div, sub_list, class: 'accordion-inner')
78
+ if item.selected?
79
+ content_tag(:div, inner_container, {:class => 'accordion-body in collapse active', 'id' => "collapse_#{item.key}"})
80
+ else
81
+ content_tag(:div, inner_container, {:class => 'accordion-body collapse', 'id' => "collapse_#{item.key}"})
82
+ end
34
83
  end
35
84
  end
36
85
  end
@@ -1,3 +1,3 @@
1
1
  module TidaTemplate
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -9,7 +9,6 @@ $(document).ready(function() {
9
9
  $("a[rel=tooltip]").tooltip();
10
10
 
11
11
  $('.dropdown-toggle').dropdown();
12
-
13
12
  $('.date-time-picker').datetimepicker({
14
13
  format: 'yyyy-MM-dd hh:mm:ss'
15
14
  });
@@ -18,4 +17,18 @@ $(document).ready(function() {
18
17
  format: 'yyyy-MM-dd',
19
18
  pickTime: false
20
19
  });
20
+
21
+ $(".collapse").collapse({
22
+ toggle: false
23
+ });
24
+
25
+ $('.accordion-toggle').click(function() {
26
+ if (!$(this).hasClass('open')) {
27
+ $(this).addClass('open');
28
+ $('.icon-angle-left', this).removeClass('icon-angle-left').addClass('icon-angle-down');
29
+ } else {
30
+ $(this).removeClass('open');
31
+ $('.icon-angle-down', this).removeClass('icon-angle-down').addClass('icon-angle-left');
32
+ }
33
+ })
21
34
  });
@@ -52,39 +52,66 @@ $caret-size: 4px;
52
52
  }
53
53
  }
54
54
 
55
+ @mixin navigation-item {
56
+ display: block;
57
+ width: 160px; height: 29px;
58
+ padding: 5px 10px;
59
+ color: $topNavigationForeColor;
60
+ font-size: 12px;
61
+ line-height: 30px;
62
+ border-bottom: 1px solid darken($topNavigationBackgroundColor, 15%);
63
+
64
+ &:hover, &.active {
65
+ background: darken($logoColor, 15%);
66
+ color: white;
67
+ text-decoration: none !important;
68
+ }
69
+
70
+ &.open {
71
+ color: white;
72
+ }
73
+ }
74
+
55
75
  #top-navigation-bar {
56
76
  display: block;
57
77
  position: absolute;
58
78
  top: 0px; bottom: 0px;
59
79
  left: 0px; right: 0px;
60
- width: 70px;
80
+ width: 180px;
61
81
  background: $topNavigationBackgroundColor;
62
82
  padding: 0px;
63
83
 
84
+ [class*="accordion"] {
85
+ padding: 0px; margin: 0px;
86
+ border: none;
87
+ color: $topNavigationForeColor;
88
+ font-size: 12px;
89
+ }
90
+
91
+ .accordion-heading {
92
+ a {
93
+ @include navigation-item;
94
+ }
95
+ }
96
+
97
+ .accordion .accordion {
98
+ background: darken($topNavigationBackgroundColor, 5%);
99
+ }
100
+
101
+ .arrow {
102
+ position: absolute;
103
+ right: 10px;
104
+ line-height: 30px;
105
+ }
106
+
64
107
  ul {
65
108
  list-style: none;
66
109
  @include no-space;
67
110
  top: 0px;
68
111
 
69
112
  li {
70
-
71
113
  a {
72
- display: block;
73
- width: 50px; height: 40px;
74
- color: $topNavigationForeColor;
75
- font-size: 12px;
76
- text-align: center;
77
- padding: $bigPadding $normalPadding;
78
-
79
- &.active {
80
- background: darken($topNavigationBackgroundColor, 10%);
81
- color: lighten($topNavigationForeColor, 40%);
82
- }
83
-
84
- &:hover {
85
- color: lighten($topNavigationForeColor, 40%);
86
- text-decoration: none !important;
87
- }
114
+ @include navigation-item;
88
115
  }
89
116
  }
90
117
  }
@@ -103,6 +130,7 @@ $caret-size: 4px;
103
130
  }
104
131
 
105
132
  #sub-navigation-bar {
133
+ display: none;
106
134
  position: absolute;
107
135
  top: 0px; bottom: 0px;
108
136
  left: 0px; width: 199px;
@@ -48,7 +48,7 @@ $btnInverseBackground: #4c575b;
48
48
 
49
49
  // Menus
50
50
  $topNavigationBackgroundColor: #2b343d;
51
- $topNavigationForeColor: #5c6a73;
51
+ $topNavigationForeColor: #98a5b3;
52
52
  $pageMenuBackgroundColor: #f5f5f5;
53
53
  $pageMenuForeColor: #7a7977;
54
54
  $pageMenuHoverBackgroundColor: darken($pageMenuBackgroundColor, 10%);
@@ -31,16 +31,17 @@ html, body {
31
31
  top: 50px; bottom: 0px;
32
32
  left: 0px; right: 0px;
33
33
  z-index: 1;
34
+ overflow-y: auto;
34
35
 
35
36
  #main {
36
37
  position: absolute;
37
38
  top: 0px; bottom: 0px;
38
- left: 70px; right: 0px;
39
+ left: 180px; right: 0px;
39
40
 
40
41
  > .content {
41
42
  position: absolute;
42
43
  top: 0px; bottom: 31px;
43
- left: 200px; right: 0px;
44
+ left: 0px; right: 0px;
44
45
  z-index: 2;
45
46
  overflow: auto;
46
47
  }
@@ -50,7 +51,7 @@ html, body {
50
51
  > footer {
51
52
  display: block;
52
53
  position: absolute;
53
- left: 270px; bottom: 0;
54
+ left: 180px; bottom: 0;
54
55
  width: 100%; height: 30px;
55
56
  line-height: 30px;
56
57
  border-top: 1px solid $pageMenuBorderColor;
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.6
4
+ version: 0.2.7
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-08-19 00:00:00.000000000 Z
12
+ date: 2013-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -379,7 +379,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
379
379
  version: '0'
380
380
  segments:
381
381
  - 0
382
- hash: 2576668510312364
382
+ hash: 3305316306694359343
383
383
  required_rubygems_version: !ruby/object:Gem::Requirement
384
384
  none: false
385
385
  requirements:
@@ -388,7 +388,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
388
388
  version: '0'
389
389
  segments:
390
390
  - 0
391
- hash: 2576668510312364
391
+ hash: 3305316306694359343
392
392
  requirements: []
393
393
  rubyforge_project:
394
394
  rubygems_version: 1.8.25