+
Add Photo
@@ -337,6 +337,16 @@ type : 'UI Module'
Modal |
Is called after a modal is hidden. |
+
+ onApprove |
+ Modal |
+ Is called after a positive or approve button is pressed |
+
+
+ onDeny |
+ Modal |
+ Is called after a negative or cancel button is pressed. |
+
@@ -358,8 +368,10 @@ type : 'UI Module'
selector |
- selector : {
- close : '.close, .actions .button'
+ selector : {
+ close : '.close, .actions .button',
+ approve : '.actions .positive, .actions .approve',
+ deny : '.actions .negative, .actions .cancel'
},
|
diff --git a/src/modules/modal.js b/src/modules/modal.js
index 52baa9a14..79ae112d7 100755
--- a/src/modules/modal.js
+++ b/src/modules/modal.js
@@ -133,7 +133,13 @@ $.fn.modal = function(parameters) {
event: {
close: function() {
- module.verbose('Close button pressed');
+ module.verbose('Closing element pressed');
+ if( $(this).is(selector.approve) ) {
+ $.proxy(settings.onApprove, element)();
+ }
+ if( $(this).is(selector.deny) ) {
+ $.proxy(settings.onDeny, element)();
+ }
module.hide();
},
click: function(event) {
@@ -566,9 +572,13 @@ $.fn.modal.settings = {
onShow : function(){},
onHide : function(){},
+ onApprove : function(){ console.log('approved'); },
+ onDeny : function(){ console.log('denied'); },
selector : {
- close : '.close, .actions .button'
+ close : '.close, .actions .button',
+ approve : '.actions .positive, .actions .approve',
+ deny : '.actions .negative, .actions .cancel'
},
error : {
method : 'The method you called is not defined.'