From 5e0f88cc34a3efb295a1eb222587d581e6728f8f Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 5 Sep 2015 01:16:12 -0500 Subject: [PATCH] Expand error messages. More on submit blockers. Skeleton. --- tfdclerk.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/tfdclerk.js b/tfdclerk.js index f37c11a..19905d6 100644 --- a/tfdclerk.js +++ b/tfdclerk.js @@ -119,7 +119,6 @@ TFD.prototype._unblock_submit = function(reason) { }; TFD.prototype._error = function(msg, extra) { - // TODO: expand: advise refreshing, reporting persistent errors var elem = $("", { text: "Error: " + (extra ? msg + ": " : msg), style: "color: #A00;" @@ -129,6 +128,23 @@ TFD.prototype._error = function(msg, extra) { text: extra, style: "font-family: monospace;" })); + + var contact = $("", { + href: "https://en.wikipedia.org/wiki/User_talk:The_Earwig", + title: "User talk:The Earwig", + text: "contact me" + }), file_bug = $("", { + href: "https://github.com/earwig/tfdclerk", + title: "earwig/tfdclerk", + text: "file a bug report" + }); + elem.append($("
")) + .append($("", { + html: "This may be caused by an edit conflict or other " + + "intermittent problem. Try refreshing the page. If the error " + + "persists, you can " + contact.prop("outerHTML") + " or " + + file_bug.prop("outerHTML") + "." + })); elem.insertAfter(this.box.find("h5")); this._block_submit("error"); }; @@ -177,6 +193,7 @@ TFD.prototype._remove_option_box = function() { this.box.remove(); this.box = null; this._guard = false; + this._submit_blockers = []; }; TFD.prototype._add_option_box = function(verb, title, callback, options) { @@ -201,11 +218,15 @@ TFD.prototype._add_option_box = function(verb, title, callback, options) { addClass: "tfdclerk-submit mw-ui-button mw-ui-progressive", style: "margin-right: 0.5em;", disabled: this._submit_blockers.length > 0, - click: function() { callback.call(self); } + click: function() { + self._block_submit("submitting"); + self.box.find(".tfdclerk-cancel").prop("disabled", true); + callback.call(self); + } })) .append($("