Skip to main content

max / makenotwork

7.4 KB · 171 lines History Blame Raw
1 {% extends "base.html" %}
2
3 {% block title %}Settings — {{ community_name }} — Multithreaded{% endblock %}
4
5 {% block head %}<meta name="robots" content="noindex">{% endblock %}
6
7 {% block header %}{% include "partials/site_header.html" %}{% endblock %}
8
9 {% block content %}
10 <div class="container">
11 <div class="breadcrumb">
12 <a href="/">Forums</a>
13 <span class="sep">/</span>
14 <a href="/p/{{ community_slug }}">{{ community_name }}</a>
15 <span class="sep">/</span>
16 Settings
17 </div>
18 <h2 class="section-heading">Community Settings</h2>
19
20 <div class="settings-section">
21 <h3>Community Details</h3>
22 <div class="form-container">
23 <form method="post" action="/p/{{ community_slug }}/settings">
24 {% include "partials/csrf_input.html" %}
25 <div class="form-group">
26 <label for="name">Name</label>
27 <input type="text" id="name" name="name" value="{{ community_name }}" required>
28 </div>
29 <div class="form-group">
30 <label for="description">Description</label>
31 <textarea id="description" name="description" class="textarea-medium" maxlength="2048">{{ community_description.as_deref().unwrap_or("") }}</textarea>
32 </div>
33 <div class="form-group">
34 <label for="auto_hide_threshold">Auto-hide flag threshold</label>
35 <input type="number" id="auto_hide_threshold" name="auto_hide_threshold" min="0" step="1" value="{{ auto_hide_threshold.unwrap_or(0) }}" class="input-narrow">
36 <span class="form-help">Posts with this many flags are auto-hidden. 0 = disabled.</span>
37 </div>
38 <div class="form-actions">
39 <button type="submit" class="primary">Save</button>
40 </div>
41 </form>
42 </div>
43 </div>
44
45 <div class="settings-section">
46 <h3>Categories</h3>
47 {% if categories.is_empty() %}
48 <div class="empty-state">No categories yet.</div>
49 {% else %}
50 <table class="settings-table">
51 <thead>
52 <tr>
53 <th>Name</th>
54 <th>Slug</th>
55 <th>Order</th>
56 <th>Actions</th>
57 </tr>
58 </thead>
59 <tbody>
60 {% for cat in categories %}
61 <tr>
62 <td>
63 <span class="settings-cat-name">{{ cat.name }}</span>
64 {% if let Some(desc) = cat.description %}
65 <span class="settings-cat-desc">{{ desc }}</span>
66 {% endif %}
67 </td>
68 <td class="settings-mono">{{ cat.slug }}</td>
69 <td class="settings-mono">{{ cat.sort_order }}</td>
70 <td class="settings-actions">
71 <a href="/p/{{ community_slug }}/settings/categories/{{ cat.id }}/edit" class="post-action-link">edit</a>
72 {% if !cat.is_first %}
73 <form method="post" action="/p/{{ community_slug }}/settings/categories/{{ cat.id }}/move" class="form-inline">
74 {% include "partials/csrf_input.html" %}
75 <input type="hidden" name="direction" value="up">
76 <button type="submit" class="post-action-link">up</button>
77 </form>
78 {% endif %}
79 {% if !cat.is_last %}
80 <form method="post" action="/p/{{ community_slug }}/settings/categories/{{ cat.id }}/move" class="form-inline">
81 {% include "partials/csrf_input.html" %}
82 <input type="hidden" name="direction" value="down">
83 <button type="submit" class="post-action-link">down</button>
84 </form>
85 {% endif %}
86 </td>
87 </tr>
88 {% endfor %}
89 </tbody>
90 </table>
91 {% endif %}
92
93 <h3 class="section-heading-top">Add Category</h3>
94 <div class="form-container">
95 <form method="post" action="/p/{{ community_slug }}/settings/categories/new">
96 {% include "partials/csrf_input.html" %}
97 <div class="form-row">
98 <div class="form-group">
99 <label for="cat-name">Name</label>
100 <input type="text" id="cat-name" name="name" required>
101 </div>
102 <div class="form-group">
103 <label for="cat-slug">Slug</label>
104 <input type="text" id="cat-slug" name="slug" placeholder="lowercase-with-hyphens" required>
105 </div>
106 </div>
107 <div class="form-group">
108 <label for="cat-description">Description (optional)</label>
109 <textarea id="cat-description" name="description" class="textarea-short" maxlength="1024"></textarea>
110 </div>
111 <div class="form-actions">
112 <button type="submit" class="primary">Add Category</button>
113 </div>
114 </form>
115 </div>
116 </div>
117
118 <div class="settings-section">
119 <h3>Tags</h3>
120 {% if tags.is_empty() %}
121 <div class="empty-state">No tags yet.</div>
122 {% else %}
123 <table class="settings-table">
124 <thead>
125 <tr>
126 <th>Name</th>
127 <th>Slug</th>
128 <th>Actions</th>
129 </tr>
130 </thead>
131 <tbody>
132 {% for tag in tags %}
133 <tr>
134 <td>{{ tag.name }}</td>
135 <td class="settings-mono">{{ tag.slug }}</td>
136 <td class="settings-actions">
137 <form method="post" action="/p/{{ community_slug }}/settings/tags/delete" class="form-inline" data-confirm="Delete this tag?">
138 {% include "partials/csrf_input.html" %}
139 <input type="hidden" name="tag_id" value="{{ tag.id }}">
140 <button type="submit" class="post-action-link post-action-delete">delete</button>
141 </form>
142 </td>
143 </tr>
144 {% endfor %}
145 </tbody>
146 </table>
147 {% endif %}
148
149 <h3 class="section-heading-top">Add Tag</h3>
150 <div class="form-container">
151 <form method="post" action="/p/{{ community_slug }}/settings/tags/new">
152 {% include "partials/csrf_input.html" %}
153 <div class="form-row">
154 <div class="form-group">
155 <label for="tag-name">Name</label>
156 <input type="text" id="tag-name" name="name" required>
157 </div>
158 <div class="form-group">
159 <label for="tag-slug">Slug</label>
160 <input type="text" id="tag-slug" name="slug" placeholder="lowercase-with-hyphens" required>
161 </div>
162 </div>
163 <div class="form-actions">
164 <button type="submit" class="primary">Add Tag</button>
165 </div>
166 </form>
167 </div>
168 </div>
169 </div>
170 {% endblock %}
171