Skip to content

Commit e5e8895

Browse files
committed
Add jqXHR parameter for error callback for form and link filter. Fix #125
1 parent 35ad207 commit e5e8895

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

‎js/jquery.nyroModal.filters.form.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jQuery(function($, undefined) {
3838
success: function(data) {
3939
nm._setCont(data, nm.store.form.sel);
4040
},
41-
error: function() {
42-
nm._error();
41+
error: function(jqXHR) {
42+
nm._error(jqXHR);
4343
}
4444
});
4545

‎js/jquery.nyroModal.filters.link.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jQuery(function($, undefined) {
3030
success: function(data) {
3131
nm._setCont(data, nm.store.link.sel);
3232
},
33-
error: function() {
34-
nm._error();
33+
error: function(jqXHR) {
34+
nm._error(jqXHR);
3535
}
3636
});
3737
$.ajax(ajax);

‎js/jquery.nyroModal.js‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ jQuery(function($, undefined) {
249249

250250
// Trigger the error
251251
// Will call 'error' callback filter
252-
_error: function() {
253-
this._callFilters('error');
252+
_error: function(jqXHR) {
253+
this._callFilters('error', jqXHR);
254254
},
255255

256256
// Set the HTML content to show.
@@ -351,26 +351,28 @@ jQuery(function($, undefined) {
351351

352352
// Call a function against all active filters
353353
// - fct: Function name
354+
// - prm: Parameter to be used in callback
354355
// return an array of all return of callbacks; keys are filters name
355-
_callFilters: function(fct) {
356+
_callFilters: function(fct, prm) {
356357
this.getInternal()._debug(fct);
357358
var ret = [],
358359
self = this;
359360
$.each(this.filters, function(i, f) {
360-
ret[f] = self._callFilter(f, fct);
361+
ret[f] = self._callFilter(f, fct, prm);
361362
});
362363
if (this.callbacks[fct] && $.isFunction(this.callbacks[fct]))
363-
this.callbacks[fct](this);
364+
this.callbacks[fct](this, prm);
364365
return ret;
365366
},
366367

367368
// Call a filter function for a specific filter
368369
// - f: Filter name
369370
// - fct: Function name
371+
// - prm: Parameter to be used in callback
370372
// return the return of the callback
371-
_callFilter: function(f, fct) {
373+
_callFilter: function(f, fct, prm) {
372374
if (_filters[f] && _filters[f][fct] && $.isFunction(_filters[f][fct]))
373-
return _filters[f][fct](this);
375+
return _filters[f][fct](this, prm);
374376
return undefined;
375377
},
376378

0 commit comments

Comments
 (0)