waiter 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4d2f680fc70be78d002e4226d7691156cc8636c
4
- data.tar.gz: add2d246198843ee695aa4cc8f1924bd9c685e3e
3
+ metadata.gz: f3e58f7bdbd2922ea052ab0c23c895520a241e1a
4
+ data.tar.gz: 6ba519cb637f4b2e7c25e984c8dd7a8650f89a19
5
5
  SHA512:
6
- metadata.gz: 6730406ac7a9262963fddd461ea1f0ee7370dd5c34878cd728e8b03b479d8f5bd93ef64fabcd35af7751cce74cdf5151ec35289d33723bc3ffea8a21aba85bb6
7
- data.tar.gz: 81bc0c9480cd9098c24a17ebcf5b55ea318443891a14d2d0cd0f00f381acd2dbca81905915c87946a63e9ff25bd9f70e50b9cc36c4363ee180108e1d8540ea61
6
+ metadata.gz: c5d028f8175b04b91580262ac7c5b0a212f75bb78433d0a4079ad722ea1582f89858e84273bbbc5be1b4cfb28a01218fdbe0e23d3a4ddb8646a70e6f93c60858
7
+ data.tar.gz: 37de015b017b0b9893c585e76b6ae00abbcd60c0ef6b7c24e0e5df21dba7ff02c2ce962f83f35fdfd91ff3a1b633a67e1b3a43fe273b20533a0f13bd826a1213
@@ -51,18 +51,45 @@
51
51
  $submenu-border-color: #888;
52
52
  $submenu-item-border-color: #CCC;
53
53
  $submenu-item-height: 20px;
54
+ $submenu-item-bgcolor: #E6E9EF;
55
+ $submenu-item-hover: #006EB6;
54
56
 
55
57
  ul.submenu
56
58
  {
57
59
  position: absolute;
58
60
  top: 30px;
59
61
  left: 0;
60
- background-color: #ffffff;
62
+ background-color: $submenu-item-bgcolor;
61
63
  display: none;
62
64
  z-index: 10500;
63
65
  margin: 0;
64
66
  padding: 0;
65
67
  border: 2px solid $submenu-border-color;
68
+ border-collapse: collapse;
69
+
70
+ div.column
71
+ {
72
+ border: 2px solid $submenu-border-color;
73
+ border-collapse: collapse;
74
+ }
75
+
76
+ div.section
77
+ {
78
+ & + div.section
79
+ {
80
+ border-top: 2px solid $submenu-border-color;
81
+ }
82
+
83
+ li:last-of-type
84
+ {
85
+ border-bottom: none;
86
+ }
87
+ }
88
+
89
+ div.column
90
+ {
91
+ display: table-cell;
92
+ }
66
93
 
67
94
  li
68
95
  {
@@ -70,20 +97,19 @@
70
97
  min-height: $submenu-item-height;
71
98
  line-height: $submenu-item-height;
72
99
  vertical-align: middle;
73
- background-color: #e6e9ef;
74
- border-top: 1px solid $submenu-item-border-color;
100
+ background-color: $submenu-item-bgcolor;
101
+ border-bottom: 1px solid $submenu-item-border-color;
75
102
  min-width: 150px;
76
103
  text-align: left;
77
104
  white-space: nowrap;
78
- color: #000000;
105
+ color: #000;
79
106
  border-collapse: collapse;
80
-
81
107
  font-weight: normal;
82
108
  font-size: 12px;
83
109
 
84
- a, a:hover
110
+ a, a:hover, &.heading
85
111
  {
86
- color: #000000;
112
+ color: inherit;
87
113
  font-weight: normal;
88
114
  padding-left: 8px;
89
115
  padding-right: 8px;
@@ -91,14 +117,22 @@
91
117
  height: $submenu-item-height + 12px;
92
118
  }
93
119
 
120
+ &.heading
121
+ {
122
+ font-weight: bold;
123
+ font-size: 14px;
124
+ color: #000;
125
+ }
126
+
94
127
  &:first-child
95
128
  {
96
129
  border-top: 0;
97
130
  }
98
131
 
99
- &:hover
132
+ &:not(.heading):hover
100
133
  {
101
- background-color: #ff9900;
134
+ background-color: $submenu-item-hover;
135
+ color: white;
102
136
  }
103
137
 
104
138
  &.separator
@@ -123,9 +157,7 @@
123
157
 
124
158
  &:hover ul.submenu
125
159
  {
126
- background-color: #333333;
127
- /*border:1px solid #333333;*/
128
- display: block;
160
+ display: table;
129
161
  }
130
162
  }
131
163
  }
@@ -0,0 +1,7 @@
1
+ .column
2
+ - if column.heading
3
+ %li.heading= column.heading
4
+
5
+ - count = column.items.count
6
+ - column.items(true).each.with_index do |subitem, idx|
7
+ = render 'waiter/sub_item', parent: parent, subitem: subitem, idx: idx, count: count
@@ -1,5 +1,6 @@
1
- - section.items(true).each do |subitem|
2
- = render 'waiter/sub_item', item: item, subitem: subitem
1
+ .section
2
+ - if section.heading
3
+ %li.heading= section.heading
3
4
 
4
- - unless last
5
- %li.separator
5
+ - section.items(true).each do |subitem|
6
+ = render 'waiter/submenu_item', item: item, subitem: subitem
@@ -1,2 +1,6 @@
1
- %li
2
- = link_to subitem.item_title, subitem.path
1
+ - if subitem.column?
2
+ = render 'waiter/column', parent: parent, column: subitem
3
+ - elsif subitem.section?
4
+ = render 'waiter/section', item: parent, section: subitem, last: idx == count - 1
5
+ - else
6
+ = render 'waiter/submenu_item', item: parent, subitem: subitem
@@ -1,6 +1,3 @@
1
1
  %ul.submenu
2
2
  - items.each.with_index do |subitem, idx|
3
- - if subitem.section?
4
- = render 'waiter/section', item: parent, section: subitem, last: idx == items.count - 1
5
- - else
6
- = render 'waiter/sub_item', item: parent, subitem: subitem
3
+ = render 'waiter/sub_item', parent: parent, subitem: subitem, idx: idx, count: items.count
@@ -0,0 +1,2 @@
1
+ %li
2
+ = link_to subitem.item_title, subitem.path
@@ -6,6 +6,10 @@ module Waiter
6
6
  add_section(options, &block)
7
7
  end
8
8
 
9
+ def column(options = {}, &block)
10
+ add_column(options, &block)
11
+ end
12
+
9
13
  def method_missing(name, *args, &block)
10
14
  return context.send(name, *args, &block) if context.respond_to?(name)
11
15
 
@@ -21,4 +25,4 @@ module Waiter
21
25
  return nil
22
26
  end
23
27
  end
24
- end
28
+ end
@@ -2,6 +2,7 @@ require 'waiter/dsl'
2
2
  require 'waiter/menu/item_list'
3
3
  require 'waiter/menu/item'
4
4
  require 'waiter/menu/section'
5
+ require 'waiter/menu/column'
5
6
  require 'waiter/menu/drawer'
6
7
  require 'active_support/core_ext/hash/slice'
7
8
 
@@ -38,7 +39,12 @@ module Waiter
38
39
 
39
40
  def add_section(options = {}, &block)
40
41
  section = Section.new(self, options, &block)
41
- items << section if section.items.any?
42
+ items << section unless section.empty?
43
+ end
44
+
45
+ def add_column(options = {}, &block)
46
+ column = Column.new(self, options, &block)
47
+ items << column unless column.empty?
42
48
  end
43
49
 
44
50
  def sections
@@ -62,4 +68,4 @@ module Waiter
62
68
  "#<#{self.class.name}:#{'0x%x' % (36971870 << 1)} name=#{name.inspect} options=#{options.inspect}>"
63
69
  end
64
70
  end
65
- end
71
+ end
@@ -0,0 +1,15 @@
1
+ require 'waiter/menu/section'
2
+
3
+ module Waiter
4
+ class Menu
5
+ class Column < Section
6
+ def column?
7
+ true
8
+ end
9
+
10
+ def section?
11
+ false
12
+ end
13
+ end
14
+ end
15
+ end
@@ -18,7 +18,8 @@ module Waiter
18
18
  render partial: 'waiter/menu_bar', locals: { menu: menu }
19
19
  end
20
20
 
21
- protected
21
+ protected
22
+
22
23
  def menu_selected?(name, controller, action = nil, controllers = [])
23
24
  controllers = [] unless controllers
24
25
 
@@ -40,4 +41,4 @@ module Waiter
40
41
  end
41
42
  end
42
43
  end
43
- end
44
+ end
@@ -31,10 +31,18 @@ module Waiter
31
31
  false
32
32
  end
33
33
 
34
+ def column?
35
+ false
36
+ end
37
+
34
38
  def items
35
39
  @submenu.try(:items) || []
36
40
  end
37
41
 
42
+ def empty?
43
+ items.empty?
44
+ end
45
+
38
46
  def [](name)
39
47
  return nil if items.empty?
40
48
  items[name]
@@ -134,4 +142,4 @@ module Waiter
134
142
  end
135
143
  end
136
144
  end
137
- end
145
+ end
@@ -11,6 +11,10 @@ module Waiter
11
11
  true
12
12
  end
13
13
 
14
+ def heading
15
+ options[:heading]
16
+ end
17
+
14
18
  def items(sorted = false)
15
19
  return super() unless sorted
16
20
  ItemList.new(super(), options.slice(:sort, :reverse))
@@ -23,4 +27,4 @@ module Waiter
23
27
  end
24
28
  end
25
29
  end
26
- end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Waiter
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Vandersluis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-05 00:00:00.000000000 Z
11
+ date: 2017-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -96,14 +96,17 @@ files:
96
96
  - app/assets/images/waiter/bg.gif
97
97
  - app/assets/images/waiter/selected-bg.gif
98
98
  - app/assets/stylesheets/waiter/menu.css.scss
99
+ - app/views/waiter/_column.haml
99
100
  - app/views/waiter/_item.haml
100
101
  - app/views/waiter/_menu_bar.haml
101
102
  - app/views/waiter/_section.haml
102
103
  - app/views/waiter/_sub_item.haml
103
104
  - app/views/waiter/_submenu.haml
105
+ - app/views/waiter/_submenu_item.haml
104
106
  - lib/waiter.rb
105
107
  - lib/waiter/dsl.rb
106
108
  - lib/waiter/menu.rb
109
+ - lib/waiter/menu/column.rb
107
110
  - lib/waiter/menu/drawer.rb
108
111
  - lib/waiter/menu/item.rb
109
112
  - lib/waiter/menu/item_list.rb