Page is done

This commit is contained in:
2017-10-08 15:18:38 +02:00
parent d15e4e967e
commit f471aed610
18 changed files with 453 additions and 43 deletions
+50
View File
@@ -0,0 +1,50 @@
{{ define "content" }}
<article>
<h1>{{$.Operation}}</h1>
<form action="/page/create", method="POST">
<p class="danger">{{$.Error}}</p>
<input class="big" placeholder="Page Name" name="name" type="text" value="{{$.Page.Name}}" />
<textarea class="tall" placeholder="Content" name="source">{{$.Page.Source}}</textarea>
<input placeholder="IC Date" name="fictionalDate" type="text" value="{{if $.Page.FictionalDate.IsZero}}{{else}}{{$.Page.FictionalDate}}{{end}}" />
<div class="group">
{{ range $.Categories }}
<div class="radio-wrapper">
<input name="category" type="radio" name="category" value="{{.Key}}" {{if eq $.Page.Category .Key}}checked{{end}}><b> {{.Key}}</b>: {{.Info}}</input>
</div>
{{ end }}
</div>
<textarea name="tags" placeholder="Tags, e.g. 'Location: Miner's Respite'. One per line, topmost is primary tag">{{$.TagInput}}</textarea>
<div class="group">
<div class="radio-wrapper">
<input type="checkbox" name="dated" value="true" {{if $.Page.Dated}}checked{{end}}><b> Dated</b>: The IC date is shown on the page list. It will still be used for sorting if this option is disabled.</input>
</div>
<div class="radio-wrapper">
<input type="checkbox" name="unlisted" value="true" {{if $.Page.Unlisted}}checked{{end}}><b> Unlisted</b>: This page will not show up on page lists, but anyone with a link can view it.</input>
</div>
<div class="radio-wrapper">
<input type="checkbox" name="specific" value="true" {{if $.Page.Specific}}checked{{end}}><b> Specific</b>: This page will only show up on page lists when one of its tags is searched for.</input>
</div>
</div>
<!-- Future option -->
<input type="hidden" name="type" value="Markdown" />
<input type="hidden" name="published" value="True" />
<button type="submit">{{$.Operation}}</button>
</form>
</article>
{{ end }}
{{ define "menu" }}
<a href="/"><h1>Aite RP</h1></a>
<ul>
<li><a href="/"><div class="mg-icon">&lt;</div><div class="mg-label">Back</div></a></li>
</ul>
{{ end }}
{{ define "head" }}
<link rel="stylesheet" href="/ui/css/form.css" />
<script type="text/javascript" src="/ui/js/form-page.js"></script>
{{ end }}
+37
View File
@@ -0,0 +1,37 @@
{{ define "content" }}
<article class="narrow">
<h1 class="danger">Delete Page</h1>
<form action="/page/delete/{{$.Page.ID}}", method="POST">
<p class="danger">
This is an irreversible action, so make sure that this is the correct page!
</p>
<ul>
<li><b>ID:</b> {{$.Page.ID}}</li>
<li><b>Name:</b> {{$.Page.Name}}</li>
<li><b>Category:</b> {{$.Page.Category}}</li>
<li><b>Published:</b> {{$.Page.PublishDate | formatDateLong}}</li>
</ul>
<input type="hidden" name="aft" value="{{$.User.SessionID}}" />
<button type="submit">Delete Page</button>
</article>
{{ end }}
{{ define "menu" }}
<a href="/"><h1>Page</h1></a>
{{ if eq $.User.ID $.Page.Author}}
<ul>
<li><a href="/page/edit/{{$.Page.ID}}"><div class="mg-icon">E</div><div class="mg-label">Edit</div></a></li>
<li class="selected"><a href="/page/delete/{{$.Page.ID}}"><div class="mg-icon">X</div><div class="mg-label">Delete</div></a></li>
</ul>
{{ end }}
<ul>
<li><a href="/page/{{$.Page.ID}}"><div class="mg-icon">&lt;</div><div class="mg-label">Back</div></a></li>
</ul>
{{ end }}
{{ define "head" }}
<link rel="stylesheet" href="/ui/css/form.css" />
{{ end }}
+50
View File
@@ -0,0 +1,50 @@
{{ define "content" }}
<article>
<h1>{{$.Operation}}</h1>
<form action="/page/edit/{{$.Page.ID}}", method="POST">
<p class="danger">{{$.Error}}</p>
<input class="big" placeholder="Page Name" name="name" type="text" value="{{$.Page.Name}}" />
<textarea class="tall" placeholder="Content" name="source">{{$.Page.Source}}</textarea>
<input placeholder="IC Date" name="fictionalDate" type="text" value="{{if $.Page.FictionalDate.IsZero}}{{else}}{{$.Page.FictionalDate}}{{end}}" />
<div class="group">
{{ range $.Categories }}
<div class="radio-wrapper">
<input name="category" type="radio" name="category" value="{{.Key}}" {{if eq $.Page.Category .Key}}checked{{end}}><b> {{.Key}}</b>: {{.Info}}</input>
</div>
{{ end }}
</div>
<textarea name="tags" placeholder="Tags, e.g. 'Location: Miner's Respite'. One per line, topmost is primary tag">{{$.TagInput}}</textarea>
<div class="group">
<div class="radio-wrapper">
<input type="checkbox" name="dated" value="true" {{if $.Page.Dated}}checked{{end}}><b> Dated</b>: The IC date is shown on the page list. It will still be used for sorting if this option is disabled.</input>
</div>
<div class="radio-wrapper">
<input type="checkbox" name="unlisted" value="true" {{if $.Page.Unlisted}}checked{{end}}><b> Unlisted</b>: This page will not show up on page lists, but anyone with a link can view it.</input>
</div>
<div class="radio-wrapper">
<input type="checkbox" name="specific" value="true" {{if $.Page.Specific}}checked{{end}}><b> Specific</b>: This page will only show up on page lists when one of its tags is searched for.</input>
</div>
</div>
<!-- Future option -->
<input type="hidden" name="type" value="Markdown" />
<input type="hidden" name="published" value="True" />
<button type="submit">{{$.Operation}}</button>
</form>
</article>
{{ end }}
{{ define "menu" }}
<a href="/"><h1>Aite RP</h1></a>
<ul>
<li><a href="/"><div class="mg-icon">&lt;</div><div class="mg-label">Back</div></a></li>
</ul>
{{ end }}
{{ define "head" }}
<link rel="stylesheet" href="/ui/css/form.css" />
<script type="text/javascript" src="/ui/js/form-page.js"></script>
{{ end }}
+44
View File
@@ -0,0 +1,44 @@
{{ define "content" }}
<article class="narrow">
{{$.Page.Content}}
</article>
{{ end }}
{{ define "menu" }}
<a href="/page/{{$.Page.ID}}"><h1>Page</h1></a>
{{ if $.Page.Dated}}
<div class="page-property">{{$.Page.FictionalDate | formatDate}}</div>
{{ else }}
<div class="page-property">{{$.Page.PublishDate | formatDate}}</div>
{{ end }}
<ul>
{{ range $.Page.Tags }}
<li><a href="/{{.Hook}}"><div class="mg-icon">{{.Icon}}</div><div class="mg-label {{.CSSCLass}}">{{.Name}}</div></a></li>
{{ end }}
</ul>
{{ if eq $.User.ID $.Page.Author}}
<ul>
<li><a href="/page/edit/{{$.Page.ID}}"><div class="mg-icon">E</div><div class="mg-label">Edit</div></a></li>
<li><a href="/page/delete/{{$.Page.ID}}"><div class="mg-icon">X</div><div class="mg-label">Delete</div></a></li>
</ul>
{{ end }}
<ul>
<li><a href="/"><div class="mg-icon">&lt;</div><div class="mg-label">Back</div></a></li>
</ul>
{{ if $.User.LoggedIn }}
<ul>
<li><a href="/user/logout"><div class="mg-icon">A</div><div class="mg-label">Logout</div></a></li>
</ul>
{{ else }}
<ul>
<li><a href="/user/login"><div class="mg-icon">A</div><div class="mg-label">Login</div></a></li>
</ul>
{{ end }}
{{ end }}
{{ define "head" }}
{{ end }}