From 4e887e124f7a110c86adea837cd6bfc421d4fc40 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Thu, 2 Aug 2012 19:17:50 +0200 Subject: [PATCH] Remove the "Execute" button This button has to be equivalent to another button anyway. --- js/adhoc.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/js/adhoc.js b/js/adhoc.js index 3638eef..a4e1574 100644 --- a/js/adhoc.js +++ b/js/adhoc.js @@ -156,6 +156,7 @@ Adhoc.prototype = { var self = this; var status = $(result).find("command").attr("status"); var kinds = {'prev': 'Prev', 'next': 'Next', 'complete': 'Complete'}; + var actions = $(result).find("actions:first"); $(self.status.view).empty(); $(result).find("command > *").each(function() { @@ -168,20 +169,15 @@ Adhoc.prototype = { if (status === "executing") { var controls = $("
"); for (kind in kinds) { - var input; - (function(type) { - input = $("").click(function() { - self.executeCommand(type, (type!= 'prev') && self.serializeToDataform('form'), function(e) { self.displayResult(e) }); - }).appendTo(controls); - })(kind); - if ($(result).find('actions ' + kind).length > 0) + var input = $("").click(function() { + self.executeCommand(kind, (kind != 'prev') && self.serializeToDataform('form'), function(e) { self.displayResult(e) }); + }).appendTo(controls); + if (actions.find(kind).length > 0) input.removeAttr("disabled"); + if (actions.attr("execute") == kind) + input.addClass("primary"); } - $("").click(function() { - self.executeCommand("execute", self.serializeToDataform('form'), function(e) { self.displayResult(e) }); - }).appendTo(controls); - $("").click(function() { self.cancelCommand(function(e) { self.displayResult(e) }); }).appendTo(controls); -- 2.39.5