easy_menu 0.4.16 → 0.5.0
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 +4 -4
- data/app/assets/javascripts/easy_menu_jquery.js +24 -15
- data/app/assets/stylesheets/easy_menu.css.scss +2 -3
- data/lib/menu_bar.rb +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b1e9ced377fa41ccde18eb63585c26db224c90265189c18630cf3912bb4df9f
|
|
4
|
+
data.tar.gz: dd2dfb7d78dc212fa78c3b4f129d5ce5537fe6ef32e13677fe9506fc01b5b4e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f1f95ffcbff00e46f1ba6eaef34244b86da72c97d73daf97a530b712c025457d8d9f2b6ce1aef57fa5d41fcf8f329176ec5c61530244f8fde5fd25c127edbf15
|
|
7
|
+
data.tar.gz: 6a5f6e530e9c2da66101db87c0bab4002322aa75b8f3f9ea21c3eaeae42de23b4c2da3f74a2d854aeffdc5bc0f782fb87d93bff4b67dcbaf48a074ed56081718
|
|
@@ -4,7 +4,10 @@ $(document).ready(function() {
|
|
|
4
4
|
// Because some browsers don't support submit buttons outside of forms triggering form submits,
|
|
5
5
|
// do it in javascript just to make sure it happens
|
|
6
6
|
$(document).on('click', 'input[type=submit][form]', function(){
|
|
7
|
-
|
|
7
|
+
var formId = $(this).attr('form');
|
|
8
|
+
var form = document.getElementById(formId);
|
|
9
|
+
|
|
10
|
+
if (form) {
|
|
8
11
|
// If the form is already submitting, we want don't want to submit it again.
|
|
9
12
|
if ($(form).hasClass('submitting')) {
|
|
10
13
|
return false;
|
|
@@ -13,56 +16,62 @@ $(document).ready(function() {
|
|
|
13
16
|
var tempCommit = $("<input type='submit' name='commit' style='display:none'>");
|
|
14
17
|
tempCommit.attr('value', $(this).attr('value'));
|
|
15
18
|
form.appendChild(tempCommit[0]);
|
|
16
|
-
tempCommit.click
|
|
19
|
+
tempCommit.trigger('click');
|
|
17
20
|
return false;
|
|
18
21
|
}
|
|
19
22
|
});
|
|
20
23
|
// Used by the above click handler to determine if the browser already submitted the form.
|
|
21
|
-
$('form'
|
|
24
|
+
$(document).on('submit', 'form', function() {
|
|
22
25
|
$(this).addClass('submitting');
|
|
23
26
|
});
|
|
24
27
|
|
|
25
28
|
// Allow users to open and close menus by clicking
|
|
26
29
|
$(menuBarRootSelector + '.menu_bar_content.with_menu').removeClass('no_js');
|
|
27
|
-
$(menuBarRootSelector + '.menu_bar_content.with_menu .menu_bar_item'
|
|
30
|
+
$(document).on('click', menuBarRootSelector + '.menu_bar_content.with_menu .menu_bar_item', function(){
|
|
28
31
|
var mbc = $(this).closest('.menu_bar_content');
|
|
29
32
|
$(menuBarRootSelector + '.menu_bar_content.with_menu').not(mbc).removeClass('open');
|
|
30
33
|
mbc.toggleClass('open')
|
|
31
|
-
.find('.menu').trigger('opened')
|
|
34
|
+
.find('.menu').trigger('opened');
|
|
32
35
|
});
|
|
33
36
|
|
|
34
37
|
// Close the menu when the user clicks or there is a form submission
|
|
35
38
|
$(document).on('click submit', function(event) {
|
|
36
39
|
// 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 }
|
|
40
|
+
if ($(event.target).closest('.menu_bar_content.with_menu .menu_bar_item').length > 0) { return; }
|
|
38
41
|
|
|
39
42
|
// 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 }
|
|
43
|
+
if ($(event.target).closest('.menu').length > 0 && $(event.target).closest('.menu_item').length === 0) { return; }
|
|
41
44
|
|
|
42
45
|
$(menuBarRootSelector + '.menu_bar_content.with_menu.open')
|
|
43
46
|
.removeClass('open')
|
|
44
|
-
.find('.menu').trigger('closed')
|
|
47
|
+
.find('.menu').trigger('closed');
|
|
45
48
|
});
|
|
46
49
|
|
|
47
50
|
// Disable Elements with a disable condition when that condition is met
|
|
48
51
|
$(menuBarRootSelector + '.menu_bar_item[data-disable-event-element]').each(function(){
|
|
49
52
|
var mbi = $(this);
|
|
50
|
-
var
|
|
51
|
-
var event = mbi.
|
|
52
|
-
var
|
|
53
|
+
var observableElementCode = mbi.attr('data-disable-event-element');
|
|
54
|
+
var event = mbi.attr('data-disable-event');
|
|
55
|
+
var conditionCode = mbi.attr('data-disable-condition') || 'true';
|
|
53
56
|
|
|
54
57
|
var setState = function(){
|
|
55
|
-
|
|
58
|
+
var observableElement = eval(observableElementCode);
|
|
59
|
+
var condition = eval(conditionCode);
|
|
60
|
+
|
|
61
|
+
if (condition){
|
|
56
62
|
mbi.addClass('disabled');
|
|
57
63
|
} else {
|
|
58
64
|
mbi.removeClass('disabled');
|
|
59
65
|
}
|
|
60
|
-
}
|
|
66
|
+
};
|
|
61
67
|
|
|
62
68
|
// Init the current state and bind the observer
|
|
63
|
-
if (
|
|
69
|
+
if (observableElementCode && event){
|
|
64
70
|
setState();
|
|
65
|
-
observableElement
|
|
71
|
+
var observableElement = eval(observableElementCode);
|
|
72
|
+
if (observableElement) {
|
|
73
|
+
$(observableElement).on(event, setState);
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
76
|
});
|
|
68
77
|
});
|
|
@@ -137,10 +137,9 @@
|
|
|
137
137
|
|
|
138
138
|
}
|
|
139
139
|
&.with_menu {
|
|
140
|
-
.menu_bar_item .arrow{
|
|
140
|
+
.menu_bar_item .arrow {
|
|
141
141
|
@include easy_menu_icon(5, center);
|
|
142
|
-
|
|
143
|
-
padding: 24px 14px 0 0;
|
|
142
|
+
padding: 24px 0 0 0;
|
|
144
143
|
vertical-align: middle;
|
|
145
144
|
width: 10px;
|
|
146
145
|
display: inline-block;
|
data/lib/menu_bar.rb
CHANGED
|
@@ -84,7 +84,7 @@ class MenuBar
|
|
|
84
84
|
arrow = @template.content_tag(:span, '', :class => config[:menu_bar_item_arrow_class])
|
|
85
85
|
|
|
86
86
|
m = Menu.new(config, options)
|
|
87
|
-
mbt = MenuBarTrigger.new(config, button_text.html_safe + arrow, m, options[:menu_bar_item])
|
|
87
|
+
mbt = MenuBarTrigger.new(config, button_text.html_safe + ' ' + arrow, m, options[:menu_bar_item])
|
|
88
88
|
|
|
89
89
|
yield m if block_given?
|
|
90
90
|
|
|
@@ -170,7 +170,7 @@ class MenuBar
|
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
def to_s
|
|
173
|
-
empty? ? '' : wrap_content(@content.join.html_safe) # Don't render anything if empty
|
|
173
|
+
empty? ? ''.html_safe : wrap_content(@content.join.html_safe) # Don't render anything if empty
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
def right_aligned?
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easy_menu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicholas Jakobsen
|
|
8
8
|
- Ryan Wallace
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-02-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -25,8 +25,8 @@ dependencies:
|
|
|
25
25
|
- - ">="
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '3.1'
|
|
28
|
-
description:
|
|
29
|
-
email:
|
|
28
|
+
description:
|
|
29
|
+
email:
|
|
30
30
|
executables: []
|
|
31
31
|
extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
|
@@ -44,10 +44,10 @@ files:
|
|
|
44
44
|
- lib/easy_menu_configuration.rb
|
|
45
45
|
- lib/easy_menu_helpers.rb
|
|
46
46
|
- lib/menu_bar.rb
|
|
47
|
-
homepage:
|
|
47
|
+
homepage:
|
|
48
48
|
licenses: []
|
|
49
49
|
metadata: {}
|
|
50
|
-
post_install_message:
|
|
50
|
+
post_install_message:
|
|
51
51
|
rdoc_options: []
|
|
52
52
|
require_paths:
|
|
53
53
|
- lib
|
|
@@ -62,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
63
|
version: '0'
|
|
64
64
|
requirements: []
|
|
65
|
-
rubygems_version: 3.
|
|
66
|
-
signing_key:
|
|
65
|
+
rubygems_version: 3.4.1
|
|
66
|
+
signing_key:
|
|
67
67
|
specification_version: 4
|
|
68
68
|
summary: Simple menu bar DSL for Rails views
|
|
69
69
|
test_files: []
|