diff --git a/tfdclerk.js b/tfdclerk.js index 30cea03..766b86d 100644 --- a/tfdclerk.js +++ b/tfdclerk.js @@ -70,7 +70,7 @@ mw.loader.using(["mediawiki.ui", "jquery.ui.core"], function() { .css("margin", "0.5em 0") .css("padding", "1em") .append($("
", {text: title, style: "padding-top: 0;"})); - options(box, box.prop("id") + "-"); + options(box, head, box.prop("id") + "-"); box.append($("", { text: verb.charAt(0).toUpperCase() + verb.slice(1), addClass: "mw-ui-button mw-ui-progressive", @@ -116,15 +116,86 @@ mw.loader.using(["mediawiki.ui", "jquery.ui.core"], function() { TFDClerk._remove_option_box(box); }; + TFDClerk._is_merge = function(head) { + return head.nextUntil("h4").filter("p").first().find("b") + .text() == "Propose merging"; + }; + + TFDClerk._build_close_results = function(box, head, prefix) { + if (TFDClerk._is_merge(head)) + var choices = ["Merge", "Do not merge", "No consensus"]; + else + var choices = ["Delete", "Keep", "Redirect", "No consensus"]; + + var elems = $(""); + + $("").append($("", { + name: "result-speedy", + type: "checkbox", + value: "true" + })).append($("", { + text: "Speedy", + style: "margin-right: 1em;" + })).appendTo(elems); + + $.each(choices, function(i, choice) { + $("").append($("", { + name: "result", + type: "radio", + value: choice + })).append($("", { + text: choice, + style: "margin-right: 1em;" + })).appendTo(elems); + }); + + $("").append($("", { + name: "result", + type: "radio", + value: "Other" + })).append($("", { + text: "Other: " + })).append($("", { + name: "result-other", + type: "text" + })).appendTo(elems); + + return elems; + }; + + TFDClerk._build_close_actions = function(box, head, prefix) { + // TODO + }; + TFDClerk.close = function(head) { if (!TFDClerk._guard(head)) return; TFDClerk._add_option_box( head, "close", "Closing discussion", TFDClerk._do_close, - function(box, prefix) { + function(box, head, prefix) { TFDClerk._add_option_table(box, [ - // TODO + [ + $("", {text: "Result:"}), + TFDClerk._build_close_results(box, head, prefix) + ], + [ + $("", { + for: prefix + "comments", + text: "Comments:" + }), + $("", { + id: prefix + "comments", + name: "comments", + rows: 2, + cols: 60, + placeholder: "Optional. Do not sign." + }) + ], + [ + $("", {text: "Actions:"}), + TFDClerk._build_close_actions(box, head, prefix) + ] ]); }); }; @@ -135,7 +206,7 @@ mw.loader.using(["mediawiki.ui", "jquery.ui.core"], function() { TFDClerk._add_option_box( head, "relist", "Relisting discussion", TFDClerk._do_relist, - function(box, prefix) { + function(box, head, prefix) { TFDClerk._add_option_table(box, [ [ $("", {