From 037cc2887961d09cea26e05ebf2c01a3e0ab3736 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 20 Jul 2011 14:17:12 +0200 Subject: [PATCH] added delete button to entity info dialog --- htdocs/frontend/javascripts/entity.js | 21 ++++++++++++++++++++- htdocs/frontend/javascripts/functions.js | 8 ++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/htdocs/frontend/javascripts/entity.js b/htdocs/frontend/javascripts/entity.js index a2dcbd5..38fd039 100644 --- a/htdocs/frontend/javascripts/entity.js +++ b/htdocs/frontend/javascripts/entity.js @@ -98,13 +98,32 @@ Entity.prototype.loadData = function() { * Show and edit entity details */ Entity.prototype.showDetails = function() { + var entity = this; + $('
') .addClass('details') .append(this.getDOMDetails()) .dialog({ title: 'Details für ' + this.title, width: 480, - resizable: false + resizable: false, + buttons : { + 'Schließen': function() { + $(this).dialog('close'); + }, + 'Löschen' : function() { + vz.load({ // TODO encapsulate in own method + controller: 'entity', + context: this, + identifier: entity.uuid, + url: entity.middleware, + type: 'DELETE', + success: function() { + $(this).dialog('close'); + } + }); + } + } }); }; diff --git a/htdocs/frontend/javascripts/functions.js b/htdocs/frontend/javascripts/functions.js index 8e9a785..ae502a1 100644 --- a/htdocs/frontend/javascripts/functions.js +++ b/htdocs/frontend/javascripts/functions.js @@ -79,6 +79,14 @@ vz.load = function(args) { args.url += '.json'; + if (args.data === undefined) { + args.data = { }; + } + + if (args.type) { + args.data.operation = args.type.toLowerCase(); + } + return $.ajax(args); };