A clean, Markdown-based publishing platform made for writers. Write together, and build a community. https://writefreely.org
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.
 
 
 
 
 

78 lines
2.2 KiB

  1. {{define "view-page"}}
  2. {{template "header" .}}
  3. <style>
  4. label {
  5. display: block;
  6. margin-top: 1em;
  7. padding: 0 0 1em;
  8. color: #666;
  9. }
  10. .content-desc {
  11. font-size: 0.95em;
  12. }
  13. .page-desc {
  14. margin: 0 0 0.5em;
  15. }
  16. textarea + .content-desc {
  17. margin: 0.5em 0 1em;
  18. font-style: italic;
  19. }
  20. input[type=text] {
  21. /* Match textarea color. TODO: y is it like this thooo */
  22. border-color: #ccc;
  23. }
  24. </style>
  25. <div class="snug content-container">
  26. {{template "admin-header" .}}
  27. <h2 id="posts-header">{{if eq .Content.ID "landing"}}Home page{{else}}{{.Content.ID}} page{{end}}</h2>
  28. {{if eq .Content.ID "about"}}
  29. <p class="page-desc content-desc">Describe what your instance is <a href="/about" target="page">about</a>.</p>
  30. {{else if eq .Content.ID "privacy"}}
  31. <p class="page-desc content-desc">Outline your <a href="/privacy" target="page">privacy policy</a>.</p>
  32. {{else if eq .Content.ID "reader"}}
  33. <p class="page-desc content-desc">Customize your <a href="/read" target="page">Reader</a> page.</p>
  34. {{else if eq .Content.ID "landing"}}
  35. <p class="page-desc content-desc">Customize your <a href="/?landing=1" target="page">home page</a>.</p>
  36. {{end}}
  37. {{if .Message}}<p>{{.Message}}</p>{{end}}
  38. <form method="post" action="/admin/update/{{.Content.ID}}" onsubmit="savePage(this)">
  39. {{if .Banner}}
  40. <label for="banner">
  41. Banner
  42. </label>
  43. <textarea id="banner" class="section codable norm edit-page" style="min-height: 5em; height: 5em;" name="banner">{{.Banner.Content}}</textarea>
  44. <p class="content-desc">We suggest a header (e.g. <code># Welcome</code>), optionally followed by a small bit of text. Accepts Markdown and HTML.</p>
  45. {{else}}
  46. <label for="title">
  47. Title
  48. </label>
  49. <input type="text" name="title" id="title" value="{{.Content.Title.String}}" />
  50. {{end}}
  51. <label for="content">
  52. {{if .Banner}}Body{{else}}Content{{end}}
  53. </label>
  54. <textarea id="content" class="section codable norm edit-page" name="content">{{.Content.Content}}</textarea>
  55. <p class="content-desc">Accepts Markdown and HTML.</p>
  56. <input type="submit" value="Save" />
  57. </form>
  58. </div>
  59. <script>
  60. function savePage(el) {
  61. var $btn = el.querySelector('input[type=submit]');
  62. $btn.value = 'Saving...';
  63. $btn.disabled = true;
  64. }
  65. </script>
  66. {{template "footer" .}}
  67. {{end}}