summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-24 17:47:51 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-02-24 17:47:51 +0100
commitb4fa3cd44d7b6827ca385f60e72d4f7798a3e02f (patch)
treefbf63ffade6444c19902337320a71f803b1e60ba /module/web/static/js/views
parentparse category from addons (diff)
downloadpyload-b4fa3cd44d7b6827ca385f60e72d4f7798a3e02f.tar.xz
added confirm dialogs
Diffstat (limited to 'module/web/static/js/views')
-rw-r--r--module/web/static/js/views/abstract/modalView.js31
-rw-r--r--module/web/static/js/views/selectionView.js5
2 files changed, 31 insertions, 5 deletions
diff --git a/module/web/static/js/views/abstract/modalView.js b/module/web/static/js/views/abstract/modalView.js
index 56c060a42..e0542d552 100644
--- a/module/web/static/js/views/abstract/modalView.js
+++ b/module/web/static/js/views/abstract/modalView.js
@@ -3,6 +3,7 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
return Backbone.View.extend({
events: {
+ 'click .btn-confirm': 'confirm',
'click .btn-close': 'hide',
'click .close': 'hide'
},
@@ -10,12 +11,22 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
template: null,
dialog: null,
- initialize: function() {
+ onHideDestroy: false,
+ confirmCallback: null,
+
+ initialize: function(template, confirm) {
+ this.confirmCallback = confirm;
var self = this;
if (this.template === null) {
- require(['text!tpl/default/modal.html'], function(template) {
- self.template = template;
- });
+ if (template) {
+ this.template = template;
+ // When template was provided this is a temporary dialog
+ this.onHideDestroy = true;
+ }
+ else
+ require(['text!tpl/default/modal.html'], function(template) {
+ self.template = template;
+ });
}
},
@@ -26,6 +37,8 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
this.$el.css({opacity: 0, scale: 0.7});
$("body").append(this.el);
+ var self = this;
+
this.dialog = this.$el.omniWindow({
overlay: {
selector: '#modal-overlay',
@@ -34,6 +47,8 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
hide: function(subjects, internalCallback) {
subjects.overlay.transition({opacity: 'hide', delay: 100}, 300, function() {
internalCallback(subjects);
+ if (self.onHideDestroy)
+ self.destroy();
});
},
show: function(subjects, internalCallback) {
@@ -74,9 +89,17 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
this.dialog.trigger('hide');
},
+ confirm: function() {
+ if (this.confirmCallback)
+ this.confirmCallback.apply();
+
+ this.hide();
+ },
+
destroy: function() {
this.$el.remove();
this.dialog = null;
+ this.remove();
}
});
diff --git a/module/web/static/js/views/selectionView.js b/module/web/static/js/views/selectionView.js
index 8dbd069bd..6d346b6ee 100644
--- a/module/web/static/js/views/selectionView.js
+++ b/module/web/static/js/views/selectionView.js
@@ -80,7 +80,10 @@ define(['jquery', 'backbone', 'underscore', 'app'],
},
pause: function() {
- // TODO
+ _.confirm('default/confirmDialog.html', function() {
+ alert("Not implemented yet");
+ this.deselect();
+ }, this);
},
trash: function() {