summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-02-01 15:31:44 -0500
committerJules Laplace <jules@okfoc.us>2015-02-01 15:31:44 -0500
commitbc843c0c65d9ff98dac35a72821f7e312dc7e62b (patch)
tree853dce36e390178ca0564f97793e4deb655b099d
parent97e7312439b24bfdd255f6868e8b42c469b0b38e (diff)
let confirmModal take two callbacks
-rw-r--r--public/assets/javascripts/ui/lib/ConfirmModal.js24
1 files changed, 17 insertions, 7 deletions
diff --git a/public/assets/javascripts/ui/lib/ConfirmModal.js b/public/assets/javascripts/ui/lib/ConfirmModal.js
index a72b31e..7d9da67 100644
--- a/public/assets/javascripts/ui/lib/ConfirmModal.js
+++ b/public/assets/javascripts/ui/lib/ConfirmModal.js
@@ -4,21 +4,31 @@ var ConfirmModal = new( ModalFormView.extend({
el: ".mediaDrawer.confirm",
events: {
- "click .yes": "advance",
- "click .no": "hide",
+ "click .yes": "agree",
+ "click .no": "cancel",
},
- confirm: function(question, callback){
+ confirm: function(question, agreeCallback, cancelCallback){
this.$(".question").empty().append(question)
- this.callback = callback
+ this.agreeCallback = agreeCallback
+ this.cancelCallback = cancelCallback
this.show()
},
- advance: function(e){
+ agree: function(e){
e && e.preventDefault()
this.hide()
- this.callback && this.callback()
- this.callback = null
+ this.agreeCallback && this.agreeCallback()
+ this.agreeCallback = null
+ this.cancelCallback = null
+ },
+
+ cancel: function(e){
+ e && e.preventDefault()
+ this.hide()
+ this.cancelCallback && this.cancelCallback()
+ this.agreeCallback = null
+ this.cancelCallback = null
}
}) ) \ No newline at end of file