From 507d2802e6e195a82b05c240ceda6562c2803d4b Mon Sep 17 00:00:00 2001 From: slyx Date: Mon, 22 Aug 2011 21:41:57 +0200 Subject: added confirmation dialog before deleting a package --- module/web/templates/default/package_ui.js | 17 ++++++++++++++--- module/web/templates/default/queue.html | 8 ++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'module/web/templates/default') diff --git a/module/web/templates/default/package_ui.js b/module/web/templates/default/package_ui.js index 1d0e25dd6..d2828a2f0 100644 --- a/module/web/templates/default/package_ui.js +++ b/module/web/templates/default/package_ui.js @@ -2,6 +2,7 @@ var load, pack_box; document.addEvent("domready", function() { load = new Fx.Tween($("load-indicator"), {link: "cancel"}); + confirmDeleteDialog = new Fx.Tween($("confirmDelete_box")); load.set("opacity", 0); pack_box = new Fx.Tween($('pack_box')); @@ -42,7 +43,7 @@ function show_pack() { function hide_pack() { bg_hide(); pack_box.start('opacity', 0).chain(function() { - $('pack_box').setStyle('display', 'none'); + $$('.window_box').setStyle('display', 'none'); }); } @@ -177,7 +178,7 @@ var Package = new Class({ this.folder = this.ele.getElements('.folder')[0]; this.password = this.ele.getElements('.password')[0]; - imgs[1].addEvent('click', this.deletePackage.bind(this)); + imgs[1].addEvent('click', this.confirmDeletePackage.bind(this)); imgs[2].addEvent('click', this.restartPackage.bind(this)); @@ -290,6 +291,14 @@ var Package = new Class({ } }, + confirmDeletePackage: function(event) { + bg_show(); + $('confirmDelete_box').setStyle('display', 'block'); + confirmDeleteDialog.start('opacity', 1) + + $('confirmDelete_button').addEvent('click', this.deletePackage.bind(this)); + }, + deletePackage: function(event) { indicateLoad(); new Request({ @@ -301,6 +310,7 @@ var Package = new Class({ }.bind(this), onFailure: indicateFail }).send(); + hide_pack(); event.stop(); }, @@ -383,4 +393,5 @@ var Package = new Class({ } } -}); \ No newline at end of file +}); + diff --git a/module/web/templates/default/queue.html b/module/web/templates/default/queue.html index e1535a12e..3077b5316 100644 --- a/module/web/templates/default/queue.html +++ b/module/web/templates/default/queue.html @@ -70,6 +70,14 @@ document.addEvent("domready", function(){ {% endfor %} + +
+

{{_("Delete Package")}}

+

{{_("Are you sure, that you want to delete this package?")}}

+ + +
+ {% include "default/edit_package.html" %} {% endblock %} -- cgit v1.2.3