story-content: Added add chapter
This commit is contained in:
@@ -21,7 +21,7 @@ module.exports = class {
|
||||
}
|
||||
|
||||
chapterTitle(chapter) {
|
||||
let title = "Chapter " + this.input.story.chapters.indexOf(chapter) + 1
|
||||
let title = "Chapter " + (this.input.story.chapters.indexOf(chapter) + 1)
|
||||
if (chapter.title) {
|
||||
title = chapter.title
|
||||
} else if (chapter.fictionalDate && chapter.fictionalDate.getUTCFullYear() > 1) {
|
||||
@@ -31,7 +31,11 @@ module.exports = class {
|
||||
return title
|
||||
}
|
||||
|
||||
selectChapter(id) {
|
||||
this.state.selectedChapter = id
|
||||
select(kind, id) {
|
||||
if (kind === "chapter") {
|
||||
this.state.selectedChapter = id
|
||||
}
|
||||
|
||||
this.emit("select", kind, id)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
<menu user=input.user>
|
||||
<menu-header>${input.story.name}</menu-header>
|
||||
<for(chapter in input.story.chapters | status-var=loop)>
|
||||
<menu-link key=chapter.id on-click("selectChapter", chapter.id) href=("#" + chapter.id) selected=(state.selectedChapter === chapter.id) icon=(loop.getIndex()+1)>${component.chapterTitle(chapter)}</menu-link>
|
||||
<menu-link key=chapter.id on-click("select", "chapter", chapter.id) href=("#" + chapter.id) selected=(state.selectedChapter === chapter.id) icon=(loop.getIndex()+1)>${component.chapterTitle(chapter)}</menu-link>
|
||||
</for>
|
||||
<menu-link dark key="_create" on-click("select", "add", null) icon="+">Add Chapter</menu-link>
|
||||
</menu>
|
||||
Reference in New Issue
Block a user