]> git.babelmonkeys.de Git - adhocweb.git/commitdiff
Remove the "Execute" button
authorFlorian Zeitz <florob@babelmonkeys.de>
Thu, 2 Aug 2012 17:17:50 +0000 (19:17 +0200)
committerFlorian Zeitz <florob@babelmonkeys.de>
Thu, 2 Aug 2012 17:17:50 +0000 (19:17 +0200)
This button has to be equivalent to another button anyway.

js/adhoc.js

index 3638eef87a99fc4c0c86040c228b340a26a690b0..a4e157426e902b90590e7aee04868e9a1747acc7 100644 (file)
@@ -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 = $("<div class='actions'/>");
             for (kind in kinds) {
-               var input;
-                (function(type) {
-                    input = $("<input type='button' disabled='disabled' class='btn' value='" + kinds[type] + "'/>").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 = $("<input type='button' disabled='disabled' class='btn' value='" + kinds[kind] + "'/>").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");
             }
 
-            $("<input type='button' id='executeButton' class='btn primary' value='Execute'/>").click(function() {
-                self.executeCommand("execute", self.serializeToDataform('form'), function(e) { self.displayResult(e) });
-            }).appendTo(controls);
-
             $("<input type='button' class='btn' value='Cancel'/>").click(function() {
                 self.cancelCommand(function(e) { self.displayResult(e) });
             }).appendTo(controls);