easy_menu 0.4.6 → 0.4.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5ab5af8a5c2025b34e45706804f14bc1491c70e0
4
- data.tar.gz: 4f090a2e0b784be7622b7944cf61c9e0b352fa3d
2
+ SHA256:
3
+ metadata.gz: 67066f55569707ecc2b7bedec38a59e9e1ea638b0d91418ee321c12ddfa6809d
4
+ data.tar.gz: 852d321575f54dc6ce8fa566685fcd4f5beff1a925d15c2b25ba203ef8bdb0c3
5
5
  SHA512:
6
- metadata.gz: ad02588e586a6e13dbb820270cf6087e5c3890bc3cac9e147e9115c4e1f3e6aa0bf21cf49b018c2097307aae1fd7dfc882cc0cf725aa6a3200a3932d34f7b412
7
- data.tar.gz: ee776677c8ed61894ec0f1fc9d945d3ef4318df27a4036bd8f01a51bca3c0a7147140850782030d8401f7e1336427bb639406604dc126c30fb7727cc0501c58f
6
+ metadata.gz: 9b1f37db3f5419795b2389b1de05d8ca93cfb582a61c5cb646bf5845f61b321c1502babb42b36c6b41e477ddedaeeff27078b90bbc493e3569b6ecbc6aead7aa
7
+ data.tar.gz: 4e4651a676c1a447359ce411f58ebe47f6218f0329ee9abe2121509fef8b369737b8bb62eddd33f6b0ff311ae74ae729fa5f423906b1a78296fff0b4839b65ff
@@ -22,7 +22,7 @@ $(document).ready(function() {
22
22
  $(this).addClass('submitting');
23
23
  });
24
24
 
25
- // Allow users to open an close menus by clicking
25
+ // Allow users to open and close menus by clicking
26
26
  $(menuBarRootSelector + '.menu_bar_content.with_menu').removeClass('no_js');
27
27
  $(menuBarRootSelector + '.menu_bar_content.with_menu .menu_bar_item').click(function(){
28
28
  var mbc = $(this).closest('.menu_bar_content');
@@ -31,9 +31,14 @@ $(document).ready(function() {
31
31
  .find('.menu').trigger('opened')
32
32
  });
33
33
 
34
- // Close the menu if the user clicked outside
35
- $(document).click(function(event){
36
- if ($(event.target).closest('.menu_bar_content.with_menu .menu_bar_item').length > 0) { return } // Don't close the menus if the click came from a menu
34
+ // Close the menu when the user clicks or there is a form submission
35
+ $(document).on('click submit', function(event) {
36
+ // Don't close the menu if the click was on a menu_bar_item. This case is handled by the previous event handler
37
+ if ($(event.target).closest('.menu_bar_content.with_menu .menu_bar_item').length > 0) { return }
38
+
39
+ // Don't close if we clicked inside a menu but not on a menu_item
40
+ if ($(event.target).closest('.menu').length > 0 && $(event.target).closest('.menu_item').length === 0) { return }
41
+
37
42
  $(menuBarRootSelector + '.menu_bar_content.with_menu.open')
38
43
  .removeClass('open')
39
44
  .find('.menu').trigger('closed')
@@ -56,7 +56,7 @@ $menu-bar-item-pressed-zindex: 3;
56
56
 
57
57
  }
58
58
  @mixin gradient($start, $end){
59
- // IE 9+
59
+ // IE 9
60
60
  background-image: data_url('image/svg+xml', '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none">
61
61
  <linearGradient id="grad-ucgg-generated" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%">
62
62
  <stop offset="0%" stop-color="#{$start}" stop-opacity="1"/>
@@ -64,6 +64,8 @@ $menu-bar-item-pressed-zindex: 3;
64
64
  </linearGradient>
65
65
  <rect x="0" y="0" width="1" height="1" fill="url(#grad-ucgg-generated)" />
66
66
  </svg>');
67
+ // IE 10+
68
+ background-image: -ms-linear-gradient(top, $start 0%, $end 100%);
67
69
 
68
70
  background-image: -moz-linear-gradient(top, $start 0%, $end 100%);
69
71
  background-image: -webkit-linear-gradient(top, $start 0%, $end 100%);
@@ -104,7 +106,7 @@ $menu-bar-item-pressed-zindex: 3;
104
106
  &.warning{ @include menu_bar_item_warning_colour }
105
107
  &.inverse{ @include menu_bar_item_inverse_colour }
106
108
 
107
- @include menu_bar_item_disabled;
109
+ &.disabled { @include menu_bar_item_disabled }
108
110
  }
109
111
 
110
112
  @mixin menu_bar_item_base{
@@ -167,9 +169,11 @@ $menu-bar-item-pressed-zindex: 3;
167
169
  }
168
170
 
169
171
  @mixin menu_bar_item_disabled{
170
- &.disabled{
171
- @include button_colour(#fefefe, #dddede, $menu-bar-item-disabled-text-color, 0 1px 1px rgba(255, 255, 255, 0.75));
172
- cursor: default;
172
+ @include button_colour(#fefefe, #dddede, $menu-bar-item-disabled-text-color, 0 1px 1px rgba(255, 255, 255, 0.75));
173
+ cursor: default;
174
+
175
+ &:active{
176
+ box-shadow: none;
173
177
  }
174
178
  }
175
179
 
@@ -32,7 +32,7 @@ class MenuBar
32
32
 
33
33
  yield mbg if block_given?
34
34
 
35
- store_menu_bar_content(mbc)
35
+ store_menu_bar_content(mbc, options)
36
36
  @groups << mbg
37
37
 
38
38
  return mbg
@@ -48,7 +48,7 @@ class MenuBar
48
48
 
49
49
  mbc = MenuBarContent.new(config, content, options)
50
50
 
51
- store_menu_bar_content(mbc)
51
+ store_menu_bar_content(mbc, options)
52
52
 
53
53
  return mbc
54
54
  end
@@ -61,7 +61,7 @@ class MenuBar
61
61
  mbi = MenuBarItem.new config, content, options
62
62
  mbc = MenuBarContent.new(config, mbi, options[:menu_bar_content])
63
63
 
64
- store_menu_bar_content(mbc)
64
+ store_menu_bar_content(mbc, options)
65
65
 
66
66
  return mbi
67
67
  end
@@ -73,7 +73,7 @@ class MenuBar
73
73
  mbi = MenuBarItem.new config, mbin, options[:menu_bar_item]
74
74
  mbc = MenuBarContent.new(config, mbi, options[:menu_bar_content])
75
75
 
76
- store_menu_bar_content(mbc)
76
+ store_menu_bar_content(mbc, options)
77
77
 
78
78
  return mbi
79
79
  end
@@ -91,7 +91,7 @@ class MenuBar
91
91
  # We give the menu bar content a special class so we can treat its contents differently than one without a menu inside
92
92
  mbc = MenuBarContent.new(config, mbt, merge_class(options[:menu_bar_content], config[:menu_bar_content_with_menu_class]))
93
93
 
94
- store_menu_bar_content(mbc)
94
+ store_menu_bar_content(mbc, options)
95
95
 
96
96
  return m
97
97
  end
@@ -100,7 +100,7 @@ class MenuBar
100
100
  s = @template.content_tag :div, '', :class => config[:menu_bar_separator_class]
101
101
  mbc = MenuBarContent.new(config, s, options.reverse_merge(:remove_if_dangling => @options[:remove_dangling_separators]))
102
102
 
103
- store_menu_bar_content(mbc)
103
+ store_menu_bar_content(mbc, options)
104
104
 
105
105
  return s
106
106
  end
@@ -140,9 +140,11 @@ class MenuBar
140
140
  return html_opts
141
141
  end
142
142
 
143
- # Ensure that right aligned menu bar content appears on the page in the order it is inserted
144
- def store_menu_bar_content(mbc)
145
- if mbc.right_aligned?
143
+ def store_menu_bar_content(mbc, options = {})
144
+ if options[:index]
145
+ @content.insert(options[:index], mbc)
146
+ # Ensure that right aligned menu bar content appears on the page in the order it is inserted
147
+ elsif mbc.right_aligned?
146
148
  @content.prepend(mbc)
147
149
  else
148
150
  @content << mbc
@@ -164,7 +166,7 @@ class MenuBar
164
166
  end
165
167
 
166
168
  def empty?
167
- @content.join.blank?
169
+ @content.all?(&:blank?)
168
170
  end
169
171
 
170
172
  def to_s
@@ -291,7 +293,9 @@ class MenuBar
291
293
 
292
294
  yield mg if block_given?
293
295
 
294
- @content << MenuContent.new(config, [mgt, mg], options[:menu_content])
296
+ mc = MenuContent.new(config, [mgt, mg], options[:menu_content])
297
+
298
+ store_menu_content(mc, options)
295
299
 
296
300
  return mg
297
301
  end
@@ -304,21 +308,27 @@ class MenuBar
304
308
  content = block.call
305
309
  end
306
310
 
307
- @content << MenuContent.new(config, content, options)
311
+ mc = MenuContent.new(config, content, options)
312
+
313
+ store_menu_content(mc, options)
308
314
  end
309
315
 
310
316
  def menu_item(content, options = {})
311
317
  initialize_options(options)
312
318
 
313
319
  mi = MenuItem.new(config, content, options)
314
- @content << MenuContent.new(config, mi, options[:menu_content])
320
+ mc = MenuContent.new(config, mi, options[:menu_content])
321
+
322
+ store_menu_content(mc, options)
315
323
 
316
324
  return mi
317
325
  end
318
326
 
319
- def separator
327
+ def separator(options = {})
320
328
  s = @template.content_tag :div, '', :class => config[:menu_separator_class]
321
- @content << MenuContent.new(config, s)
329
+ mc = MenuContent.new(config, s)
330
+
331
+ store_menu_content(mc, options)
322
332
 
323
333
  return s
324
334
  end
@@ -332,6 +342,14 @@ class MenuBar
332
342
 
333
343
  return options
334
344
  end
345
+
346
+ def store_menu_content(mc, options = {})
347
+ if options[:index]
348
+ @content.insert(options[:index], mc)
349
+ else
350
+ @content << mc
351
+ end
352
+ end
335
353
  end
336
354
 
337
355
  class MenuGroup < Menu
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.4.6
4
+ version: 0.4.11
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: 2015-03-10 00:00:00.000000000 Z
12
+ date: 2020-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -31,7 +31,6 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - Gemfile
35
34
  - MIT-LICENSE
36
35
  - README
37
36
  - app/assets/images/icons.png
@@ -64,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
63
  version: '0'
65
64
  requirements: []
66
65
  rubyforge_project:
67
- rubygems_version: 2.2.2
66
+ rubygems_version: 2.7.9
68
67
  signing_key:
69
68
  specification_version: 4
70
69
  summary: Simple menu bar dsl for Rails views
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "http://rubygems.org"
2
- gem "rails", "~> 3.1.0"