Long time no see. A bunch of stuff I cba to summarize.
the build was successful

This commit is contained in:
2019-03-07 23:13:46 +01:00
parent 494d0404ed
commit 490725ecd2
20 changed files with 642 additions and 17 deletions
@@ -11,6 +11,7 @@ module.exports = class {
title: "",
source: "",
fictionalDate: "",
commentMode: "Disabled",
},
}
@@ -19,18 +20,18 @@ module.exports = class {
onInput(input) {
if (input.chapter && !this.first) {
let {fictionalDate, title, source} = input.chapter
let {fictionalDate, title, source, commentMode, commentsLocked} = input.chapter
if (fictionalDate != null) {
fictionalDate = moment.utc(fictionalDate).format("MMM D, YYYY")
}
this.state.values = {fictionalDate, title, source}
this.state.values = {fictionalDate, title, source, commentMode, commentsLocked}
}
}
change(key, ev) {
this.state.values[key] = ev.target.value
this.state.values = Object.assign({}, this.state.values, {[key]: ev.target.value})
}
open() {
@@ -60,7 +61,7 @@ module.exports = class {
fictionalDate = null
}
const input = {storyId: this.input.storyId, title: values.title, source: values.source, fictionalDate}
const input = {storyId: this.input.storyId, title: values.title, source: values.source, fictionalDate, commentMode: values.commentMode}
chapterApi.addChapter(input).then(chapter => {
this.emit("add", chapter)
@@ -70,11 +71,12 @@ module.exports = class {
title: "",
source: "",
fictionalDate: "",
commentMode: "Disabled",
}
}).catch(errs => {
console.warn("Failed to edit:", errs)
this.state.error = "Failed to edit: " + errs[0].message
this.state.error = "Failed to edit: " + (errs[0]||errs||{}).message || errs
}).then(() => {
this.state.loading = false
})
@@ -12,5 +12,13 @@
<label>Content</label>
<textarea key="source" placeholder="" class="tall" on-change("change", "source") value=state.values.source />
<label>Comments</label>
<select key="kind" class="big" placeholder="Kind" on-change("change", "commentMode") value=state.values.commentMode>
<option value="Disabled" selected=(state.values.commentMode === "Disabled")>Disabled – Hide all comments</option>
<option value="Article" selected=(state.values.commentMode === "Article")>Article – Looks like story chapters</option>
<option value="Chat" selected=(state.values.commentMode === "Chat")>Chat – One-line chat messages</option>
<option value="Message" selected=(state.values.commentMode === "Message")>Message – Extranet Mail</option>
</select>
<button disabled=state.loading on-click("save")>Save</button>
</modal>