瀏覽代碼

Expand error messages. More on submit blockers. Skeleton.

develop
Ben Kurtovic 8 年之前
父節點
當前提交
5e0f88cc34
共有 1 個文件被更改,包括 50 次插入5 次删除
  1. +50
    -5
      tfdclerk.js

+ 50
- 5
tfdclerk.js 查看文件

@@ -119,7 +119,6 @@ TFD.prototype._unblock_submit = function(reason) {
}; };


TFD.prototype._error = function(msg, extra) { TFD.prototype._error = function(msg, extra) {
// TODO: expand: advise refreshing, reporting persistent errors
var elem = $("<span/>", { var elem = $("<span/>", {
text: "Error: " + (extra ? msg + ": " : msg), text: "Error: " + (extra ? msg + ": " : msg),
style: "color: #A00;" style: "color: #A00;"
@@ -129,6 +128,23 @@ TFD.prototype._error = function(msg, extra) {
text: extra, text: extra,
style: "font-family: monospace;" style: "font-family: monospace;"
})); }));

var contact = $("<a/>", {
href: "https://en.wikipedia.org/wiki/User_talk:The_Earwig",
title: "User talk:The Earwig",
text: "contact me"
}), file_bug = $("<a/>", {
href: "https://github.com/earwig/tfdclerk",
title: "earwig/tfdclerk",
text: "file a bug report"
});
elem.append($("<br/>"))
.append($("<small/>", {
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")); elem.insertAfter(this.box.find("h5"));
this._block_submit("error"); this._block_submit("error");
}; };
@@ -177,6 +193,7 @@ TFD.prototype._remove_option_box = function() {
this.box.remove(); this.box.remove();
this.box = null; this.box = null;
this._guard = false; this._guard = false;
this._submit_blockers = [];
}; };


TFD.prototype._add_option_box = function(verb, title, callback, options) { 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", addClass: "tfdclerk-submit mw-ui-button mw-ui-progressive",
style: "margin-right: 0.5em;", style: "margin-right: 0.5em;",
disabled: this._submit_blockers.length > 0, 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($("<button/>", { .append($("<button/>", {
text: "Cancel", text: "Cancel",
addClass: "mw-ui-button",
addClass: "tfdclerk-cancel mw-ui-button",
click: function() { self._remove_option_box(); } click: function() { self._remove_option_box(); }
})) }))
.insertAfter(this.head); .insertAfter(this.head);
@@ -230,12 +251,36 @@ TFD.prototype._add_option_table = function(options) {


TFD.prototype._do_close = function() { TFD.prototype._do_close = function() {
// TODO // TODO
this._remove_option_box();
// rough mockup:
// - post-submit ui updates
// - result options -> result string
// - disable comments box
// - collapse/disable/fix actions
// - add progress info area
// - "Closing discussion..."
// - add discussion close tags with result and comment, optional nac
// - " done ([[diff]])"
// - interface for closing each template
// - replace gray buttons with progressive refresh button
}; };


TFD.prototype._do_relist = function() { TFD.prototype._do_relist = function() {
// TODO // TODO
this._remove_option_box();
// rough mockup:
// - post-submit ui updates
// - date input box -> link to new discussion log page
// - disable comments box
// - add progress info area
// - "Adding discussion to new date..."
// - add discussion to new date, plus relist template
// - " done ([[diff]])"
// - "Removing discussion from old date..."
// - replace contents of section with {{relisted}}
// - " done ([[diff]])"
// - "Updating discussion link on template(s):\n* [[Template:A]]..."
// - update |link param of {{template for discussion}}
// - " done ([[diff]])"
// - replace gray buttons with progressive refresh button
}; };


TFD.prototype._is_merge = function() { TFD.prototype._is_merge = function() {


Loading…
取消
儲存