The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
2.0 KiB

6 years ago
6 years ago
6 years ago
  1. <story-content-menu key="menu" on-select("menuSelect") story=state.story selected=(input.selected || {}) user=input.user />
  2. <main>
  3. <div class="story-content">
  4. <div class="header">
  5. <h1 class="color-primary">${state.story.name}</h1>
  6. <if(!state.removed)>
  7. <if-permitted user=input.user author=state.story.author permission="story.edit">
  8. <a on-click("open", "story.edit") class="color-menu">Edit</a>
  9. </if-permitted>
  10. <if-permitted user=input.user author=state.story.author permission="story.remove">
  11. <a on-click("open", "story.remove") class="color-menu">Remove</a>
  12. </if-permitted>
  13. </if>
  14. </div>
  15. <story-tags tags=state.story.tags open=state.story.open author=state.story.author user=(!state.removed ? input.user : null) on-select("open", "story.tags")/>
  16. <annotation if(state.removed) level="error">
  17. <p>
  18. This story has been removed. Your browser has not refreshed the page yet,
  19. so you can still read it (or back it up) before leaving the page.
  20. </p>
  21. </annotation>
  22. <chapter for(chapter in state.story.chapters) key=chapter.id
  23. chapter=chapter
  24. user=(!state.removed ? input.user : null)
  25. hideTitle=(state.story.chapters[0] === chapter && chapter.title === state.story.name)
  26. on-edit("updateChapter", chapter.id) on-remove("removeChapter", chapter.id) on-move("moveChapter", chapter) />
  27. </div>
  28. <create-chapter-modal storyId=state.story.id enabled=(state.modal === "chapter.add") chapter=input.chapter on-close("close") on-add("addChapter") />
  29. <edit-story-tags-modal enabled=(state.modal === "story.tags") story=state.story on-tags("updateStoryTags") on-close("close") />
  30. <edit-story-modal enabled=(state.modal === "story.edit") story=state.story categories=input.categories on-edit("updateStory") on-close("close") />
  31. <remove-story-modal enabled=(state.modal === "story.remove") story=state.story on-remove("timeToDie") on-close("close") />
  32. </main>