Skip to content

Commit 0ea93d6

Browse files
committed
Form dialog UI: Support on cancel action
If args.cancel is passed to createForm widget, call it when cancel button is clicked. Example: createForm: { cancel: function() { ... }, ... }
1 parent 8e4d020 commit 0ea93d6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎ui/scripts/ui/dialog.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* Dialog with form
3737
*/
3838
createForm: function(args) {
39+
var cancel = args.cancel;
3940
var $formContainer = $('<div>').addClass('form-container');
4041
var $form = $('<form>').appendTo($formContainer)
4142
.submit(function() {
@@ -113,6 +114,10 @@
113114
$(this).dialog('destroy');
114115

115116
$('.hovered-elem').hide();
117+
118+
if (cancel) {
119+
cancel();
120+
}
116121
}
117122
}]
118123
}).closest('.ui-dialog').overlay();

0 commit comments

Comments
 (0)