Browse Source

story-content: Fixed update weirdness, moved edit/remove modals up

1.0
Gisle Aune 6 years ago
parent
commit
a560752eb8
  1. 2
      marko/page/story-content/components/chapter/index.marko
  2. 2
      marko/page/story-content/components/edit-chapter-modal/component.js
  3. 0
      marko/page/story-content/components/edit-chapter-modal/index.marko
  4. 9
      marko/page/story-content/components/page/component.js
  5. 2
      marko/page/story-content/components/remove-chapter-modal/component.js
  6. 0
      marko/page/story-content/components/remove-chapter-modal/index.marko
  7. 9
      marko/page/story-content/components/story-content-menu/component.js

2
marko/page/story-content/components/chapter/index.marko

@ -1,6 +1,6 @@
import moment from "moment"
<div class="story-chapter" if(!state.removed)>
<div class="story-chapter">
<a class="anchor" id=input.chapter.id />
<div class="metadata">
<div class="options color-menu">

2
marko/page/story-content/components/chapter/components/edit-chapter-modal/component.js → marko/page/story-content/components/edit-chapter-modal/component.js

@ -1,6 +1,6 @@
const moment = require("moment")
const {chapterApi} = require("../../../../../../../rpdata/api/Chapter")
const {chapterApi} = require("../../../../../rpdata/api/Chapter")
module.exports = class {
onCreate(input) {

0
marko/page/story-content/components/chapter/components/edit-chapter-modal/index.marko → marko/page/story-content/components/edit-chapter-modal/index.marko

9
marko/page/story-content/components/page/component.js

@ -16,6 +16,7 @@ module.exports = class {
addChapter(chapter) {
this.state.story.chapters.push(chapter)
this.refreshStory()
}
updateChapter(id, data) {
@ -31,6 +32,8 @@ module.exports = class {
this.state.story.chapters[index][key] = data[key]
}
this.refreshStory()
}
removeChapter(id) {
@ -40,6 +43,8 @@ module.exports = class {
}
this.state.story.chapters.splice(index, 1)
this.refreshStory()
}
menuSelect(kind, id) {
@ -51,4 +56,8 @@ module.exports = class {
break
}
}
refreshStory() {
this.state.story = Object.assign({}, this.state.story)
}
}

2
marko/page/story-content/components/chapter/components/remove-chapter-modal/component.js → marko/page/story-content/components/remove-chapter-modal/component.js

@ -1,6 +1,6 @@
const moment = require("moment")
const {chapterApi} = require("../../../../../../../rpdata/api/Chapter")
const {chapterApi} = require("../../../../../rpdata/api/Chapter")
module.exports = class {
onCreate(input) {

0
marko/page/story-content/components/chapter/components/remove-chapter-modal/index.marko → marko/page/story-content/components/remove-chapter-modal/index.marko

9
marko/page/story-content/components/story-content-menu/component.js

@ -4,20 +4,11 @@ module.exports = class {
onCreate(input) {
this.state = {
selectedChapter: "",
bullshit: 0,
}
}
onMount() {
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) {

Loading…
Cancel
Save