story-content: Fixed update weirdness, moved edit/remove modals up
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
|
|
||||||
<div class="story-chapter" if(!state.removed)>
|
<div class="story-chapter">
|
||||||
<a class="anchor" id=input.chapter.id />
|
<a class="anchor" id=input.chapter.id />
|
||||||
<div class="metadata">
|
<div class="metadata">
|
||||||
<div class="options color-menu">
|
<div class="options color-menu">
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
const moment = require("moment")
|
const moment = require("moment")
|
||||||
|
|
||||||
const {chapterApi} = require("../../../../../../../rpdata/api/Chapter")
|
const {chapterApi} = require("../../../../../rpdata/api/Chapter")
|
||||||
|
|
||||||
module.exports = class {
|
module.exports = class {
|
||||||
onCreate(input) {
|
onCreate(input) {
|
||||||
@@ -16,6 +16,7 @@ module.exports = class {
|
|||||||
|
|
||||||
addChapter(chapter) {
|
addChapter(chapter) {
|
||||||
this.state.story.chapters.push(chapter)
|
this.state.story.chapters.push(chapter)
|
||||||
|
this.refreshStory()
|
||||||
}
|
}
|
||||||
|
|
||||||
updateChapter(id, data) {
|
updateChapter(id, data) {
|
||||||
@@ -31,6 +32,8 @@ module.exports = class {
|
|||||||
|
|
||||||
this.state.story.chapters[index][key] = data[key]
|
this.state.story.chapters[index][key] = data[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.refreshStory()
|
||||||
}
|
}
|
||||||
|
|
||||||
removeChapter(id) {
|
removeChapter(id) {
|
||||||
@@ -40,6 +43,8 @@ module.exports = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.state.story.chapters.splice(index, 1)
|
this.state.story.chapters.splice(index, 1)
|
||||||
|
|
||||||
|
this.refreshStory()
|
||||||
}
|
}
|
||||||
|
|
||||||
menuSelect(kind, id) {
|
menuSelect(kind, id) {
|
||||||
@@ -51,4 +56,8 @@ module.exports = class {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshStory() {
|
||||||
|
this.state.story = Object.assign({}, this.state.story)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
const moment = require("moment")
|
const moment = require("moment")
|
||||||
|
|
||||||
const {chapterApi} = require("../../../../../../../rpdata/api/Chapter")
|
const {chapterApi} = require("../../../../../rpdata/api/Chapter")
|
||||||
|
|
||||||
module.exports = class {
|
module.exports = class {
|
||||||
onCreate(input) {
|
onCreate(input) {
|
||||||
@@ -4,20 +4,11 @@ module.exports = class {
|
|||||||
onCreate(input) {
|
onCreate(input) {
|
||||||
this.state = {
|
this.state = {
|
||||||
selectedChapter: "",
|
selectedChapter: "",
|
||||||
bullshit: 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount() {
|
onMount() {
|
||||||
this.state.selectedChapter = (window.location.hash||"#").slice(1)
|
this.state.selectedChapter = (window.location.hash||"#").slice(1)
|
||||||
|
|
||||||
// Marko is being silly and needs a state change to re-render
|
|
||||||
setInterval(() => {
|
|
||||||
this.state.bullshit++
|
|
||||||
if (this.state.bullshit > 10000) {
|
|
||||||
this.state.bullshit = 0
|
|
||||||
}
|
|
||||||
}, 250)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
chapterTitle(chapter) {
|
chapterTitle(chapter) {
|
||||||
|
|||||||
Reference in New Issue
Block a user