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.

40 lines
2.6 KiB

6 years ago
6 years ago
6 years ago
  1. <div class="story-chapter">
  2. <a class="anchor" id=input.chapter.id />
  3. <h1 if(input.chapter.title && !input.hideTitle) class="title color-primary">${input.chapter.title}</h1>
  4. <div class="metadata">
  5. <div class="options color-menu">
  6. <if-permitted user=input.user author=input.chapter.author permission="chapter.edit">
  7. <a on-click("open", "edit") >Edit</a>
  8. </if-permitted>
  9. <if-permitted user=input.user author=input.chapter.author permission="chapter.move">
  10. <a on-click("open", "move") >Move</a>
  11. </if-permitted>
  12. <if-permitted user=input.user author=input.chapter.author permission="chapter.remove">
  13. <a on-click("open", "remove") >Remove</a>
  14. </if-permitted>
  15. </div>
  16. <chapter-meta kind="date" utc=true value=input.chapter.fictionalDate />
  17. <chapter-meta weak kind="date" value=input.chapter.createdDate />
  18. <chapter-meta weak kind="author" value=input.chapter.author />
  19. <chapter-meta weak kind="message" value=input.chapter.commentMode />
  20. </div>
  21. <markdown class="chapter-content color-text" source=input.chapter.source />
  22. <div class=["comment-section", "type-" + (input.chapter.commentMode.toLowerCase() || "disabled")]>
  23. <comment for(comment in input.chapter.comments) key=comment.id
  24. comment=comment
  25. locked=input.chapter.commentsLocked
  26. mode=input.chapter.commentMode
  27. user=input.user
  28. on-open("onOpenComment", comment)
  29. />
  30. <if-permitted if(input.chapter.canComment) user=input.user permission=["member", "chapter.edit"]>
  31. <div class="add-comment color-menu" on-click("open", "addComment") >Add ${state.commentLabels[input.chapter.commentMode] || "Comment"}</div>
  32. </if-permitted>
  33. </div>
  34. <edit-chapter-modal enabled=(state.modal === "edit") chapter=input.chapter on-close("close") on-edit("updateChapter") />
  35. <create-comment-modal enabled=(state.modal === "addComment") chapter=input.chapter user=input.user on-close("close") on-add("addComment") />
  36. <edit-comment-modal enabled=(state.modal === "editComment") chapter=input.chapter comment=state.selectedComment user=input.user on-close("close") on-edit("editComment") />
  37. <remove-comment-modal enabled=(state.modal === "removeComment") comment=state.selectedComment user=input.user on-close("close") on-remove("removeComment", state.selectedComment) />
  38. <move-chapter-modal enabled=(state.modal === "move") chapter=input.chapter user=input.user on-close("close") on-move("moveChapter") />
  39. <remove-chapter-modal enabled=(state.modal === "remove") chapter=input.chapter on-close("close") on-remove("removeChapter") />
  40. </div>