apps/posts/templates/admin_settings.html 3.3 K raw
1
{{define "admin_settings.html"}}{{template "admin_base.html" .}}{{end}}
2
{{define "title"}}Admin — Settings{{end}}
3
{{define "content"}}
4
  <h2>Settings</h2>
5
  {{if .Success}}<p class="success">Settings saved.</p>{{end}}
6
  <form method="POST" action="/admin/settings" class="form">
7
    <label for="blog_title">blog title</label>
8
    <input type="text" id="blog_title" name="blog_title" value="{{.BlogTitle}}" required>
9
    <label for="blog_description">blog description</label>
10
    <input type="text" id="blog_description" name="blog_description" value="{{.BlogDescription}}">
11
    <label for="nav_links">navigation links (format: [label](url) [label2](url2))</label>
12
    <textarea id="nav_links" name="nav_links" class="nav-links-input">{{.NavLinksRaw}}</textarea>
13
    <label for="favicon_url">favicon URL (leave empty for default)</label>
14
    <input type="text" id="favicon_url" name="favicon_url" value="{{.FaviconURL}}" placeholder="https://example.com/favicon.png">
15
    <label for="og_image_url">default OG image URL (used when posts don't have their own)</label>
16
    <input type="text" id="og_image_url" name="og_image_url" value="{{.OGImageURL}}" placeholder="https://example.com/og.png">
17
    <label for="default_location">default location for weather metadata</label>
18
    <input type="text" id="default_location" name="default_location" value="{{.DefaultLocation}}" placeholder="lat,long">
19
    <label for="intro_content">intro content (markdown, shown on homepage — use &#123;&#123;latest_posts&#125;&#125; to embed recent posts)</label>
20
    <textarea id="intro_content" name="intro_content" class="post-content">{{.IntroContent}}</textarea>
21
    <div class="switch-row">
22
      <label class="switch">
23
        <input type="checkbox" id="custom_css_toggle" {{if .CustomCSS}}checked{{end}}>
24
        <span class="switch-slider"></span>
25
      </label>
26
      <span class="switch-label">custom stylesheet</span>
27
    </div>
28
    <div id="custom_css_section" {{if not .CustomCSS}}class="hidden"{{end}}>
29
      <label for="custom_css">custom CSS (overrides default styles)</label>
30
      <textarea id="custom_css" name="custom_css" class="post-content">{{if .CustomCSS}}{{.CustomCSS}}{{else}}{{.DefaultCSS}}{{end}}</textarea>
31
    </div>
32
    <label for="custom_header">custom header (markdown or HTML, shown above nav on all pages)</label>
33
    <textarea id="custom_header" name="custom_header" class="nav-links-input">{{.CustomHeader}}</textarea>
34
    <label for="custom_footer">custom footer (markdown or HTML, shown at bottom of all pages)</label>
35
    <textarea id="custom_footer" name="custom_footer" class="post-content">{{.CustomFooter}}</textarea>
36
    <button type="submit">save</button>
37
  </form>
38
  <h3>Data Export</h3>
39
  <div class="form-actions">
40
    <a href="/admin/downloads/posts" class="btn">download posts</a>
41
    <a href="/admin/downloads/uploads" class="btn">download uploads</a>
42
  </div>
43
  <script>
44
    var toggle = document.getElementById('custom_css_toggle');
45
    var section = document.getElementById('custom_css_section');
46
    var cssTextarea = document.getElementById('custom_css');
47
    toggle.addEventListener('change', function() {
48
      section.classList.toggle('hidden', !this.checked);
49
    });
50
    document.querySelector('form').addEventListener('submit', function() {
51
      if (!toggle.checked) { cssTextarea.value = ''; }
52
    });
53
  </script>
54
{{end}}