easy_menu 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/menu_bar.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d487df8a9a64414036d134da144d31370d3b8c6
|
4
|
+
data.tar.gz: 5a77584b843bf38439aa7b92275aa767f2a4478b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7ac520b051771c54c55bc17877e73dceb176d0386cc4c6030db90acc2925924de970f630155c8047deff70f65c6e5c475a1c0c0035cd17587b64468d2e63d67
|
7
|
+
data.tar.gz: 690d1cbb2feae2d153f3bb5ce70b27c0cf170bf141ac9642795a63c923e8d0770e54206972a4cc55b718086764809b7f07fc20e5b9a4d0835403d7d3ad7d9a96
|
data/lib/menu_bar.rb
CHANGED
@@ -6,7 +6,7 @@ class MenuBar
|
|
6
6
|
include EasyMenu::Helpers
|
7
7
|
include EasyMenu::Configuration
|
8
8
|
|
9
|
-
attr_reader :content
|
9
|
+
attr_reader :content, :groups
|
10
10
|
|
11
11
|
def initialize(template, options = {})
|
12
12
|
@template = template
|
@@ -15,6 +15,7 @@ class MenuBar
|
|
15
15
|
config[:template] = @template
|
16
16
|
|
17
17
|
@content = []
|
18
|
+
@groups = [] # Subset of content that allows user to perform simpler non-sequential insertion into a particular group
|
18
19
|
|
19
20
|
yield self if block_given?
|
20
21
|
end
|
@@ -31,7 +32,8 @@ class MenuBar
|
|
31
32
|
|
32
33
|
yield mbg if block_given?
|
33
34
|
|
34
|
-
|
35
|
+
store_menu_bar_content(mbc)
|
36
|
+
@groups << mbg
|
35
37
|
|
36
38
|
return mbg
|
37
39
|
end
|
@@ -132,7 +134,7 @@ class MenuBar
|
|
132
134
|
|
133
135
|
# Ensure that right aligned menu bar content appears on the page in the order it is inserted
|
134
136
|
def store_menu_bar_content(mbc)
|
135
|
-
if mbc.
|
137
|
+
if mbc.right_aligned?
|
136
138
|
@content.prepend(mbc)
|
137
139
|
else
|
138
140
|
@content << mbc
|
@@ -161,6 +163,10 @@ class MenuBar
|
|
161
163
|
empty? ? '' : wrap_content(@content.join.html_safe) # Don't render anything if empty
|
162
164
|
end
|
163
165
|
|
166
|
+
def right_aligned?
|
167
|
+
options[:align].to_s == 'right'
|
168
|
+
end
|
169
|
+
|
164
170
|
private
|
165
171
|
|
166
172
|
def html_options
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_menu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Jakobsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|