summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/lib/ConfirmModal.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/javascripts/ui/lib/ConfirmModal.js')
-rw-r--r--public/assets/javascripts/ui/lib/ConfirmModal.js46
1 files changed, 28 insertions, 18 deletions
diff --git a/public/assets/javascripts/ui/lib/ConfirmModal.js b/public/assets/javascripts/ui/lib/ConfirmModal.js
index 01720bb..7d9da67 100644
--- a/public/assets/javascripts/ui/lib/ConfirmModal.js
+++ b/public/assets/javascripts/ui/lib/ConfirmModal.js
@@ -1,24 +1,34 @@
var ConfirmModal = new( ModalFormView.extend({
- el: ".mediaDrawer.confirm",
+ el: ".mediaDrawer.confirm",
- events: {
- "click .yes": "advance",
- "click .no": "hide",
- },
-
- confirm: function(question, callback){
- this.$(".question").empty().append(question)
- this.callback = callback
- this.show()
- },
-
- advance: function(e){
- e && e.preventDefault()
- this.hide()
- this.callback && this.callback()
- this.callback = null
- }
+ events: {
+ "click .yes": "agree",
+ "click .no": "cancel",
+ },
+
+ confirm: function(question, agreeCallback, cancelCallback){
+ this.$(".question").empty().append(question)
+ this.agreeCallback = agreeCallback
+ this.cancelCallback = cancelCallback
+ this.show()
+ },
+
+ agree: function(e){
+ e && e.preventDefault()
+ this.hide()
+ 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