Skip to content

Commit

Permalink
Add enabled settings
Browse files Browse the repository at this point in the history
Add nmEnable and nmDisable binding
Fix error in form filter with multiple value
  • Loading branch information
nyroDev committed Apr 10, 2013
1 parent 89d3d0b commit 5a243fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 2 additions & 5 deletions js/jquery.nyroModal.filters.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ jQuery(function($, undefined) {
});
},
load: function(nm) {
var data = {};
$.map(nm.opener.serializeArray(), function(d) {
data[d.name] = d.value;
});
var data = nm.opener.serializeArray();
if (nm.store.form.sel)
data[nm.selIndicator] = nm.store.form.sel.substring(1);
data.push({name: nm.selIndicator, value: nm.store.form.sel.substring(1)});
$.ajax($.extend(true, { type : 'get', dataType : 'text' }, nm.ajax || {}, {
url: nm.store.form.url,
data: data,
Expand Down
7 changes: 6 additions & 1 deletion js/jquery.nyroModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jQuery(function($, undefined) {
anims: {}, // Sepcific animations functions
loadFilter: undefined, // Name of the filter used for loading

enabled: true, // Indicates if it's enabled or not
modal: false, // Indicates if it's a modal window or not
closeOnEscape: true, // Indicates if the modal should close on Escape key
closeOnClick: true, // Indicates if a click on the background should close the modal
Expand Down Expand Up @@ -131,6 +132,8 @@ jQuery(function($, undefined) {
},
// Open the modal
open: function() {
if (!this.enabled)
return false;
if (this._nmOpener)
this._nmOpener._close();
this.getInternal()._pushStack(this.opener);
Expand Down Expand Up @@ -651,9 +654,11 @@ jQuery(function($, undefined) {
nm._callFilters('initFilters');
nm._callFilters('init');
nm.opener
.off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
.off('nyroModal.nyroModal nmDisable.nyroModal nmEnable.nyroModal nmClose.nyroModal nmResize.nyroModal')
.on({
'nyroModal.nyroModal': function() { nm.open(); return false;},
'nmDisable.nyroModal': function() { nm.enabled = false; return false;},
'nmEnable.nyroModal': function() { nm.enabled = true; return false;},
'nmClose.nyroModal': function() { nm.close(); return false;},
'nmResize.nyroModal': function() { nm.resize(); return false;}
});
Expand Down

0 comments on commit 5a243fc

Please sign in to comment.