app/assets/javascripts/trestle/components/_dialog.js in trestle-0.8.7 vs app/assets/javascripts/trestle/components/_dialog.js in trestle-0.8.8
- old
+ new
@@ -44,11 +44,11 @@
dialog.show();
return dialog;
};
-Trestle.Dialog.prototype.load = function(url) {
+Trestle.Dialog.prototype.load = function(url, callback) {
var dialog = this;
dialog.show();
dialog.setLoading(true);
@@ -61,9 +61,13 @@
complete: function() {
dialog.setLoading(false);
},
success: function(content) {
dialog.setContent(content);
+
+ if (callback) {
+ callback.apply(dialog);
+ }
},
error: function(xhr, status, error) {
var errorMessage = Trestle.i18n['trestle.dialog.error'] || 'The request could not be completed.';
var title = error || errorMessage;