Skip to content

Commit 5a243fc

Browse files
committed
Add enabled settings
Add nmEnable and nmDisable binding Fix error in form filter with multiple value
1 parent 89d3d0b commit 5a243fc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

js/jquery.nyroModal.filters.form.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,9 @@ jQuery(function($, undefined) {
2424
});
2525
},
2626
load: function(nm) {
27-
var data = {};
28-
$.map(nm.opener.serializeArray(), function(d) {
29-
data[d.name] = d.value;
30-
});
27+
var data = nm.opener.serializeArray();
3128
if (nm.store.form.sel)
32-
data[nm.selIndicator] = nm.store.form.sel.substring(1);
29+
data.push({name: nm.selIndicator, value: nm.store.form.sel.substring(1)});
3330
$.ajax($.extend(true, { type : 'get', dataType : 'text' }, nm.ajax || {}, {
3431
url: nm.store.form.url,
3532
data: data,

js/jquery.nyroModal.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jQuery(function($, undefined) {
4545
anims: {}, // Sepcific animations functions
4646
loadFilter: undefined, // Name of the filter used for loading
4747

48+
enabled: true, // Indicates if it's enabled or not
4849
modal: false, // Indicates if it's a modal window or not
4950
closeOnEscape: true, // Indicates if the modal should close on Escape key
5051
closeOnClick: true, // Indicates if a click on the background should close the modal
@@ -131,6 +132,8 @@ jQuery(function($, undefined) {
131132
},
132133
// Open the modal
133134
open: function() {
135+
if (!this.enabled)
136+
return false;
134137
if (this._nmOpener)
135138
this._nmOpener._close();
136139
this.getInternal()._pushStack(this.opener);
@@ -651,9 +654,11 @@ jQuery(function($, undefined) {
651654
nm._callFilters('initFilters');
652655
nm._callFilters('init');
653656
nm.opener
654-
.off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
657+
.off('nyroModal.nyroModal nmDisable.nyroModal nmEnable.nyroModal nmClose.nyroModal nmResize.nyroModal')
655658
.on({
656659
'nyroModal.nyroModal': function() { nm.open(); return false;},
660+
'nmDisable.nyroModal': function() { nm.enabled = false; return false;},
661+
'nmEnable.nyroModal': function() { nm.enabled = true; return false;},
657662
'nmClose.nyroModal': function() { nm.close(); return false;},
658663
'nmResize.nyroModal': function() { nm.resize(); return false;}
659664
});

0 commit comments

Comments
 (0)