mirror of https://github.com/writeas/writefreely
This adds a "Pages" section to the admin part of the site, and enables admins to edit the pre-defined About and Privacy pages there, instead of on the dashboard itself. It also restructures how these pages get sent around in the backend and lays the groundwork for dynamically adding static pages. The backend changes were made with more customization in mind, such as an instance-wide custom stylesheet (T563). Ref T566pull/95/head
parent
00ed2990eb
commit
a850fa14cd
@ -0,0 +1,25 @@ |
||||
{{define "pages"}} |
||||
{{template "header" .}} |
||||
|
||||
<div class="snug content-container"> |
||||
{{template "admin-header" .}} |
||||
|
||||
<h2 id="posts-header" style="display: flex; justify-content: space-between;">Pages</h2> |
||||
|
||||
<table class="classy export" style="width:100%"> |
||||
<tr> |
||||
<th>Pages</th> |
||||
<th>Last Modified</th> |
||||
</tr> |
||||
{{range .Pages}} |
||||
<tr> |
||||
<td><a href="/admin/page/{{.ID}}">{{.ID}}</a></td> |
||||
<td style="text-align:right">{{.UpdatedFriendly}}</td> |
||||
</tr> |
||||
{{end}} |
||||
</table> |
||||
|
||||
</div> |
||||
|
||||
{{template "footer" .}} |
||||
{{end}} |
@ -0,0 +1,34 @@ |
||||
{{define "view-page"}} |
||||
{{template "header" .}} |
||||
<div class="snug content-container"> |
||||
{{template "admin-header" .}} |
||||
|
||||
<h2 id="posts-header">{{.Content.ID}} page</h2> |
||||
|
||||
{{if .Message}}<p>{{.Message}}</p>{{end}} |
||||
|
||||
{{if eq .Content.ID "about"}} |
||||
<p>Describe what your instance is <a href="/about" target="page">about</a>. <em>Accepts Markdown</em>.</p> |
||||
{{else if eq .Content.ID "privacy"}} |
||||
<p>Outline your <a href="/privacy" target="page">privacy policy</a>. <em>Accepts Markdown</em>.</p> |
||||
{{else}} |
||||
<p><em>Accepts Markdown and HTML</em>.</p> |
||||
{{end}} |
||||
|
||||
<form method="post" action="/admin/update/{{.Content.ID}}" onsubmit="savePage(this)"> |
||||
<textarea id="about-editor" class="section codable norm edit-page" name="content">{{.Content.Content}}</textarea> |
||||
<input type="submit" value="Save" /> |
||||
</form> |
||||
|
||||
</div> |
||||
|
||||
<script> |
||||
function savePage(el) { |
||||
var $btn = el.querySelector('input[type=submit]'); |
||||
$btn.value = 'Saving...'; |
||||
$btn.disabled = true; |
||||
} |
||||
</script> |
||||
|
||||
{{template "footer" .}} |
||||
{{end}} |
Loading…
Reference in new issue