Permalink
Browse files

Add jqXHR parameter for error callback for form and link filter. Fix #…

  • Loading branch information...
1 parent 35ad207 commit e5e8895b53821d3c02b98a21243f2e5f163f203b @nyroDev committed Oct 21, 2012
Showing with 13 additions and 11 deletions.
  1. +2 −2 js/jquery.nyroModal.filters.form.js
  2. +2 −2 js/jquery.nyroModal.filters.link.js
  3. +9 −7 js/jquery.nyroModal.js
@@ -38,8 +38,8 @@ jQuery(function($, undefined) {
success: function(data) {
nm._setCont(data, nm.store.form.sel);
},
- error: function() {
- nm._error();
+ error: function(jqXHR) {
+ nm._error(jqXHR);
}
});
@@ -30,8 +30,8 @@ jQuery(function($, undefined) {
success: function(data) {
nm._setCont(data, nm.store.link.sel);
},
- error: function() {
- nm._error();
+ error: function(jqXHR) {
+ nm._error(jqXHR);
}
});
$.ajax(ajax);
@@ -249,8 +249,8 @@ jQuery(function($, undefined) {
// Trigger the error
// Will call 'error' callback filter
- _error: function() {
- this._callFilters('error');
+ _error: function(jqXHR) {
+ this._callFilters('error', jqXHR);
},
// Set the HTML content to show.
@@ -351,26 +351,28 @@ jQuery(function($, undefined) {
// Call a function against all active filters
// - fct: Function name
+ // - prm: Parameter to be used in callback
// return an array of all return of callbacks; keys are filters name
- _callFilters: function(fct) {
+ _callFilters: function(fct, prm) {
this.getInternal()._debug(fct);
var ret = [],
self = this;
$.each(this.filters, function(i, f) {
- ret[f] = self._callFilter(f, fct);
+ ret[f] = self._callFilter(f, fct, prm);
});
if (this.callbacks[fct] && $.isFunction(this.callbacks[fct]))
- this.callbacks[fct](this);
+ this.callbacks[fct](this, prm);
return ret;
},
// Call a filter function for a specific filter
// - f: Filter name
// - fct: Function name
+ // - prm: Parameter to be used in callback
// return the return of the callback
- _callFilter: function(f, fct) {
+ _callFilter: function(f, fct, prm) {
if (_filters[f] && _filters[f][fct] && $.isFunction(_filters[f][fct]))
- return _filters[f][fct](this);
+ return _filters[f][fct](this, prm);
return undefined;
},

0 comments on commit e5e8895

Please sign in to comment.