From eb0e67ed59acff47ce34716912bf593e6642e4ee Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 18 May 2015 17:29:28 -0400 Subject: [PATCH] Modal now only closes on approve or deny selector match --- src/definitions/modules/modal.js | 40 +++++++++------------- src/themes/default/modules/modal.variables | 5 ++- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index d1b1a1339..4aecbbfa3 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -202,6 +202,8 @@ $.fn.modal = function(parameters) { module.verbose('Attaching events'); $module .on('click' + eventNamespace, selector.close, module.event.close) + .on('click' + eventNamespace, selector.approve, module.event.approve) + .on('click' + eventNamespace, selector.deny, module.event.deny) ; $window .on('resize' + elementNamespace, module.event.resize) @@ -216,30 +218,22 @@ $.fn.modal = function(parameters) { }, event: { - close: function() { - var - $element = $(this) - ; - module.verbose('Closing element activated'); - if( $element.is(selector.approve) ) { - if(settings.onApprove.call(element, $element) !== false) { - module.hide(); - } - else { - module.verbose('Approve callback returned false cancelling hide'); - } - } - else if( $element.is(selector.deny) ) { - if(settings.onDeny.call(element, $element) !== false) { - module.hide(); - } - else { - module.verbose('Deny callback returned false cancelling hide'); - } + approve: function() { + if(settings.onApprove.call(element, $(this)) === false) { + module.verbose('Approve callback returned false cancelling hide'); + return; } - else { - module.hide(); + module.hide(); + }, + deny: function() { + if(settings.onDeny.call(element, $(this)) === false) { + module.verbose('Deny callback returned false cancelling hide'); + return; } + module.hide(); + }, + close: function() { + module.hide(); }, click: function(event) { var @@ -884,7 +878,7 @@ $.fn.modal.settings = { onDeny : function(){ return true; }, selector : { - close : '.close, .actions .button', + close : '.close', approve : '.actions .positive, .actions .approve, .actions .ok', deny : '.actions .negative, .actions .deny, .actions .cancel', modal : '.ui.modal' diff --git a/src/themes/default/modules/modal.variables b/src/themes/default/modules/modal.variables index 5cddbbf65..12027422b 100644 --- a/src/themes/default/modules/modal.variables +++ b/src/themes/default/modules/modal.variables @@ -6,7 +6,10 @@ @border: none; @zIndex: 1001; @borderRadius: @defaultBorderRadius; -@boxShadow: 1px 3px 10px 2px rgba(0, 0, 0, 0.5); +@boxShadow: + 1px 3px 3px 0px rgba(0, 0, 0, 0.2), + 1px 3px 15px 2px rgba(0, 0, 0, 0.2) +; /* Close Icon */ @closeOpacity: 0.8;