This commit is contained in:
@@ -11,6 +11,8 @@ module.exports = class {
|
||||
title: "",
|
||||
source: "",
|
||||
fictionalDate: "",
|
||||
commentMode: "Article",
|
||||
commentsLocked: false,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -19,18 +21,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() {
|
||||
@@ -55,7 +57,7 @@ module.exports = class {
|
||||
fictionalDate = null
|
||||
}
|
||||
|
||||
const input = {id: this.input.chapter.id, title: values.title, source: values.source}
|
||||
const input = {id: this.input.chapter.id, title: values.title, source: values.source, commentsLocked: values.commentsLocked, commentMode: values.commentMode}
|
||||
|
||||
if (fictionalDate != null) {
|
||||
input.fictionalDate = fictionalDate
|
||||
|
||||
@@ -12,5 +12,17 @@
|
||||
<label>Content</label>
|
||||
<textarea key="source" placeholder="Content" 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>
|
||||
<toggle value=state.values.commentsLocked on="Locked" off="Unlocked"
|
||||
onDesc="Logged-in users can post comments."
|
||||
offDesc="Nobody can post comments to this chapter."
|
||||
on-change("change", "commentsLocked") />
|
||||
|
||||
<button disabled=state.loading on-click("save")>Save</button>
|
||||
</modal>
|
||||
Reference in New Issue
Block a user