Permalink
Browse files

Add enabled settings

Add nmEnable and nmDisable binding
Fix error in form filter with multiple value
  • Loading branch information...
1 parent 89d3d0b commit 5a243fcb35eb7e270c0f9c8a633f4eb1523b190c @nyroDev committed Apr 10, 2013
Showing with 8 additions and 6 deletions.
  1. +2 −5 js/jquery.nyroModal.filters.form.js
  2. +6 −1 js/jquery.nyroModal.js
@@ -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,
@@ -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
@@ -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);
@@ -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;}
});

0 comments on commit 5a243fc

Please sign in to comment.