data, logs, logs-content, story, story-content: Added permission check in UI to hide disallowed actions.
This commit is contained in:
@@ -4,8 +4,12 @@ import moment from "moment"
|
||||
<a class="anchor" id=input.chapter.id />
|
||||
<div class="metadata">
|
||||
<div class="options color-menu">
|
||||
<a on-click("open", "edit") >Edit</a>
|
||||
<a on-click("open", "remove") >Remove</a>
|
||||
<if-permitted user=input.user author=input.chapter.author permission="chapter.edit">
|
||||
<a on-click("open", "edit") >Edit</a>
|
||||
</if-permitted>
|
||||
<if-permitted user=input.user author=input.chapter.author permission="chapter.remove">
|
||||
<a on-click("open", "remove") >Remove</a>
|
||||
</if-permitted>
|
||||
</div>
|
||||
<chapter-meta kind="title" value=input.chapter.title />
|
||||
<chapter-meta kind="date" value=input.chapter.fictionalDate />
|
||||
|
||||
@@ -3,17 +3,23 @@
|
||||
<div class="story-content">
|
||||
<div class="header">
|
||||
<h1 class="color-primary">${state.story.name}</h1>
|
||||
<a on-click("open", "story.edit") class="color-menu">Edit</a>
|
||||
<a on-click("open", "story.remove") class="color-menu">Remove</a>
|
||||
<if(!state.removed)>
|
||||
<if-permitted user=input.user author=state.story.author permission="story.edit">
|
||||
<a on-click("open", "story.edit") class="color-menu">Edit</a>
|
||||
</if-permitted>
|
||||
<if-permitted user=input.user author=state.story.author permission="story.remove">
|
||||
<a on-click("open", "story.remove") class="color-menu">Remove</a>
|
||||
</if-permitted>
|
||||
</if>
|
||||
</div>
|
||||
<story-tags tags=state.story.tags on-select("open", "story.tags")/>
|
||||
<story-tags tags=state.story.tags author=state.story.author user=(!state.removed ? input.user : null) on-select("open", "story.tags")/>
|
||||
<annotation if(state.removed) level="error">
|
||||
<p>
|
||||
This story has been removed. Your browser has not refreshed the page yet,
|
||||
so you can still read it (or back it up) before leaving the page.
|
||||
</p>
|
||||
</annotation>
|
||||
<chapter for(chapter in state.story.chapters) key=chapter.id chapter=chapter on-edit("updateChapter", chapter.id) on-remove("removeChapter", chapter.id)/>
|
||||
<chapter for(chapter in state.story.chapters) key=chapter.id chapter=chapter user=(!state.removed ? input.user : null) on-edit("updateChapter", chapter.id) on-remove("removeChapter", chapter.id)/>
|
||||
</div>
|
||||
|
||||
<create-chapter-modal storyId=state.story.id enabled=(state.modal === "chapter.add") chapter=input.chapter on-close("close") on-add("addChapter") />
|
||||
|
||||
@@ -3,5 +3,14 @@
|
||||
<for(chapter in input.story.chapters | status-var=loop)>
|
||||
<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>
|
||||
<if(input.story.open)>
|
||||
<if-permitted user=input.user permission=["member", "story.edit"]>
|
||||
<menu-link dark key="_create" on-click("select", "add", null) icon="+">Add Chapter (Open)</menu-link>
|
||||
</if-permitted>
|
||||
</if>
|
||||
<else>
|
||||
<if-permitted user=input.user author=input.story.author permission="story.edit">
|
||||
<menu-link dark key="_create" on-click("select", "add", null) icon="+">Add Chapter</menu-link>
|
||||
</if-permitted>
|
||||
</else>
|
||||
</menu>
|
||||
@@ -1,4 +1,6 @@
|
||||
<div class="story-tags">
|
||||
<a for(tag in input.tags) href=("/story/by-tag/" + tag.kind + "/" + encodeURIComponent(tag.name)) class=["tag", "color-tag-" + tag.kind.toLowerCase()]>${tag.name}</a>
|
||||
<a on-click("select", "edit") class="option color-menu">Edit</a>
|
||||
<if-permitted user=input.user author=input.author permission="story.edit">
|
||||
<a on-click("select", "edit") class="option color-menu">Manage Tags</a>
|
||||
</if-permitted>
|
||||
</div>
|
||||
@@ -3,6 +3,8 @@ div.story-tags {
|
||||
margin-bottom: 1em;
|
||||
margin-top: -1em;
|
||||
|
||||
min-height: 2em;
|
||||
|
||||
a.tag {
|
||||
display: inline-block;
|
||||
margin: 0.5em 0.5ch;
|
||||
|
||||
Reference in New Issue
Block a user