From 7999add4bc3625ba68e1e068b9daf09c0e027e4d Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 6 Sep 2015 14:48:45 -0500 Subject: [PATCH] Backlink summary API logic. --- tfdclerk.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/tfdclerk.js b/tfdclerk.js index 4edf975..ba12e84 100644 --- a/tfdclerk.js +++ b/tfdclerk.js @@ -76,15 +76,17 @@ TFD = function(id, head) { TFDClerk.api_get = function(tfd, params, done, fail, always) { TFDClerk._api.get(params) .done(function(data) { - if (done !== undefined) + if (done) done.call(tfd, data); }) .fail(function(error) { - if (done !== undefined) + if (fail) fail.call(tfd, error); + else + tfd._error("API query failure", error); }) .always(function() { - if (always !== undefined) + if (always) always.call(tfd); }); }; @@ -207,9 +209,7 @@ TFD.prototype._with_content = function(callback) { callback.call(this, content); for (var i in this._wikitext_callbacks) this._wikitext_callbacks[i].call(this, content); - }, function(error) { - this._error("API query failure", error); - }, function() { + }, null, function() { this._wikitext_callbacks = []; }); }; @@ -339,6 +339,9 @@ TFD.prototype._build_close_results = function() { else var choices = ["Delete", "Keep", "Redirect", "No consensus"]; + // TODO: block submit until one is selected; possibly disable individual + // action options based on what is picked + var elems = $("
"); $("