tree@da7808a actually disable post box upon submission

This commit is contained in:
Anton Dyudin 2017-05-26 15:59:13 -07:00
parent efc571f004
commit 5c6b95808f

View File

@ -1927,6 +1927,9 @@ module.exports = query({
}, },
onSubmit: function(e) { onSubmit: function(e) {
var comment, path, title; var comment, path, title;
this.setState({
loading: true
});
title = this.refs["in"].title.value; title = this.refs["in"].title.value;
comment = this.refs["in"].comment.value; comment = this.refs["in"].comment.value;
path = this.props.path || "/"; path = this.props.path || "/";
@ -1939,27 +1942,26 @@ module.exports = query({
}); });
}, },
render: function() { render: function() {
var _attr, bodyTextArea, postButton, titleInput; var bodyTextArea, postButton, titleInput;
_attr = {}; titleInput = input({
if (this.state.loading === true) { disabled: this.state.loading ? "true" : void 0,
_attr.disabled = "true";
}
titleInput = input(_.create(_attr, {
type: "text", type: "text",
name: "title", name: "title",
placeholder: "Title" placeholder: "Title"
})); });
bodyTextArea = textarea(_.create(_attr, { bodyTextArea = textarea({
disabled: this.state.loading ? "true" : void 0,
type: "text", type: "text",
name: "comment", name: "comment",
value: this.state.value, value: this.state.value,
onChange: this.onChange onChange: this.onChange
})); });
postButton = input(_.create(_attr, { postButton = input({
disabled: this.state.loading ? "true" : void 0,
type: "submit", type: "submit",
value: "Post", value: "Post",
className: "btn btn-primary" className: "btn btn-primary"
})); });
return div({}, div({ return div({}, div({
className: "add-post" className: "add-post"
}, form({ }, form({
@ -3153,14 +3155,18 @@ module.exports = {
} }
}, },
dateFromAtom: function(date) { dateFromAtom: function(date) {
var __, day, hor, min, mon, ref, sec, str, yer; var __, d, day, hor, min, mon, ref, sec, yer;
ref = date.slice(1).split("."), yer = ref[0], mon = ref[1], day = ref[2], __ = ref[3], hor = ref[4], min = ref[5], sec = ref[6]; ref = date.slice(1).split("."), yer = ref[0], mon = ref[1], day = ref[2], __ = ref[3], hor = ref[4], min = ref[5], sec = ref[6];
if (day != null) { if (day != null) {
str = yer + "-" + mon + "-" + day; d = new Date();
if (hor != null) { d.setYear(yer);
str += " " + hor + ":" + min + ":" + sec; d.setMonth(mon - 1);
} d.setDate(day);
return new Date(str); }
if (hor != null) {
d.setHours(hor);
d.setMinutes(min);
return d.setSeconds(sec);
} }
}, },
getKeys: function(kids, sortBy) { getKeys: function(kids, sortBy) {
@ -3341,8 +3347,12 @@ EventEmitter.prototype.emit = function(type) {
er = arguments[1]; er = arguments[1];
if (er instanceof Error) { if (er instanceof Error) {
throw er; // Unhandled 'error' event throw er; // Unhandled 'error' event
} else {
// At least give some kind of context to the user
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
err.context = er;
throw err;
} }
throw TypeError('Uncaught, unspecified "error" event.');
} }
} }