From 0ea93d6904ef4771b98fcdc8152bbc202da4b163 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 13 Feb 2014 14:33:53 -0800 Subject: [PATCH] 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() { ... }, ... } --- ui/scripts/ui/dialog.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index cebe16747f7..fd81e25f6aa 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -36,6 +36,7 @@ * Dialog with form */ createForm: function(args) { + var cancel = args.cancel; var $formContainer = $('
').addClass('form-container'); var $form = $('
').appendTo($formContainer) .submit(function() { @@ -113,6 +114,10 @@ $(this).dialog('destroy'); $('.hovered-elem').hide(); + + if (cancel) { + cancel(); + } } }] }).closest('.ui-dialog').overlay();