diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js index 0f07b1537..40546604d 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gameUi.js @@ -1143,23 +1143,44 @@ var GempLotrGameUI = Class.extend({ var results = this.getDecisionParameters(decision, "results"); - var html = text + "
"; - var that = this; this.smallDialog - .html(html); + .html(text); - if (!this.replayMode) { - this.smallDialog.dialog("option", "buttons", - { - "OK": function() { - $(this).dialog("close"); - that.decisionFunction(id, $("#multipleChoiceDecision").val()); - } - }); + if (results.length > 2) { + var html = "
"; + this.smallDialog.append(html); + + if (!this.replayMode) { + this.smallDialog.dialog("option", "buttons", + { + "OK": function() { + $(this).dialog("close"); + that.decisionFunction(id, $("#multipleChoiceDecision").val()); + } + }); + } + } else { + for (var i = 0; i < results.length; i++) { + this.smallDialog.append("
"); + var but = $("").button(); + but.html(results[i]); + if (!this.replayMode) { + but.click( + (function(ind) { + return function() { + $(this).dialog("close"); + that.decisionFunction(id, "" + ind); + } + })(i)); + } + this.smallDialog.append(but); + } + if (!this.replayMode) + this.smallDialog.dialog("option", "buttons", {}); } this.smallDialog.dialog("open");