diff --git a/tfdclerk.js b/tfdclerk.js
index e1c3ce9..6a458ee 100644
--- a/tfdclerk.js
+++ b/tfdclerk.js
@@ -275,6 +275,13 @@ TFD.prototype._add_option_table = function(options) {
this.box.append(table);
};
+TFD.prototype._build_loading_node = function(node, text) {
+ return $("<" + node + "/>", {
+ text: text + "...",
+ style: "font-style: italic; color: #777;"
+ });
+};
+
TFD.prototype._do_close = function() {
// TODO
// rough mockup:
@@ -333,7 +340,7 @@ TFD.prototype._build_close_results = function() {
$("").append($("", {
name: "result",
type: "radio",
- value: choice
+ value: choice.toLowerCase()
})).append($("", {
text: choice,
style: "margin: 0 1.25em 0 0.25em;"
@@ -342,7 +349,7 @@ TFD.prototype._build_close_results = function() {
$("").append($("", {
name: "result",
type: "radio",
- value: "Other"
+ value: "other"
})).append($("", {
text: "Other: ",
style: "margin: 0 0.25em;"
@@ -353,6 +360,55 @@ TFD.prototype._build_close_results = function() {
return elems;
};
+TFD.prototype._on_backlink_summary = function(tlinfo, ntrans, nmlinks) {
+ tlinfo.empty().append($("
").append($("", {
+ href: "/foobar", // TODO: actual URL here
+ title: "Transclusions of " + page,
+ text: ntrans + " transclusions"
+ })));
+
+ if (nmlinks > 0)
+ tlinfo.append($("").append($("", {
+ href: "/foobar", // TODO: actual URL here
+ title: "Mainspace links to " + page,
+ text: nmlinks + " mainspace links"
+ })));
+};
+
+TFD.prototype._build_close_action_entry = function(page) {
+ var link_id = mw.util.wikiUrlencode(page)
+ .replace(/%/g, "\\.").replace(/:/g, "\\:");
+ var redlink = $("#" + link_id).children().first().hasClass("new");
+
+ var tlinfo = $("", {style: "display: inline;"})
+ .append(this._build_loading_node("li", "Fetching transclusions"));
+ // TODO: callback to fetch backlink data and call _on_backlink_summary
+ this._block_submit("fetching-backlinks-" + page);
+
+ return $("").append($("", {
+ href: mw.util.getUrl(page),
+ title: page,
+ text: page,
+ addClass: redlink ? "new" : "",
+ style: "font-weight: bold;"
+ })).append($("", {text: ": "}))
+ .append($("", {disabled: redlink}) // TODO: fully implement
+ .append($("", {
+ value: "none",
+ text: "Do nothing",
+ selected: true
+ }))
+ .append($("", {
+ value: "holding-cell",
+ text: "Move to holding cell"
+ })))
+ // TODO: action-specific additional options here
+ .append($("", {text: " (?) ("})) // TODO: action help here
+ .append($("", {addClass: "hlist", style: "display: inline;"})
+ .append(tlinfo))
+ .append($("", {text: ")"}));
+};
+
TFD.prototype._add_close_actions = function() {
this._block_submit("add-close-actions");
this._with_content(function(content) {
@@ -364,11 +420,7 @@ TFD.prototype._add_close_actions = function() {
var list = $("", {style: "margin: 0 0 0 1em;"});
do {
var page = "Template:" + match[1];
- $("").append($("", {
- href: mw.util.getUrl(page),
- title: page,
- text: page
- })).appendTo(list);
+ this._build_close_action_entry(page).appendTo(list);
} while ((match = regex.exec(content)) !== null);
this.box.find(".tfdclerk-actions").empty().append(list);
@@ -423,11 +475,8 @@ TFD.prototype.close = function() {
],
[
$("", {text: "Actions:"}),
- $("", {addClass: "tfdclerk-actions"}).append(
- $("", {
- text: "Fetching...",
- style: "font-style: italic; color: #777;"
- })),
+ $("", {addClass: "tfdclerk-actions"})
+ .append(this._build_loading_node("span", "Fetching")),
]
]);
this._add_close_actions();