Skip to content

Commit

Permalink
Add jqXHR parameter for error callback for form and link filter. Fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
nyroDev committed Oct 21, 2012
1 parent 35ad207 commit e5e8895
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions js/jquery.nyroModal.filters.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

Expand Down
4 changes: 2 additions & 2 deletions js/jquery.nyroModal.filters.link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 9 additions & 7 deletions js/jquery.nyroModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
},

Expand Down

0 comments on commit e5e8895

Please sign in to comment.