Skip to main content

max / makenotwork

10.8 KB · 229 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>Chat</h3>
47 <div class="form-container">
48 <form method="post" action="/p/{{ community_slug }}/settings/chat">
49 {% include "partials/csrf_input.html" %}
50 <div class="form-group">
51 <label for="chat_policy">Who can use chat</label>
52 <select id="chat_policy" name="chat_policy">
53 {% for policy in chat_policies %}
54 <option value="{{ policy.as_str() }}"{% if policy.as_str() == chat_policy %} selected{% endif %}>{{ policy.label() }}</option>
55 {% endfor %}
56 </select>
57 <span class="form-help">
58 {% for policy in chat_policies %}{% if policy.as_str() == chat_policy %}{{ policy.describe() }}{% endif %}{% endfor %}
59 </span>
60 </div>
61 <div class="form-group">
62 <label for="retention_hours">Keep messages for</label>
63 <input type="number" id="retention_hours" name="retention_hours" min="1" max="{{ chat_max_retention_hours }}" step="1" value="{{ chat_retention_hours }}" class="input-narrow" required>
64 <span class="form-help">Hours, up to {{ chat_max_retention_hours }}. Chat is deleted on this schedule and there is no option to keep it forever. Shortening this applies to messages already sent.</span>
65 </div>
66 <div class="form-group">
67 <label for="max_messages">Keep at most</label>
68 <input type="number" id="max_messages" name="max_messages" min="1" max="{{ chat_message_ceiling }}" step="1" value="{{ chat_max_messages }}" class="input-narrow" required>
69 <span class="form-help">Messages, up to {{ chat_message_ceiling }}. A busy room is trimmed to this even before the time limit.</span>
70 </div>
71 <div class="form-actions">
72 <button type="submit" class="primary">Save</button>
73 </div>
74 </form>
75 </div>
76
77 {# Typed-slug confirmation, the same shape the admin clean slate uses.
78 A button alone is one misclick away from destroying everyone's
79 messages, and the server checks the phrase rather than trusting a
80 dialog the client could skip. #}
81 <div class="danger-zone">
82 <p class="form-help">
83 Delete every message in the room right now, rather than waiting for the
84 retention window. <strong>This cannot be undone.</strong> It is recorded in
85 the moderation log.
86 </p>
87 <p class="form-help">
88 To confirm, type the community slug <code>{{ community_slug }}</code> below.
89 </p>
90 <form method="post" action="/p/{{ community_slug }}/settings/chat/wipe" class="form-container">
91 {% include "partials/csrf_input.html" %}
92 <div class="form-group">
93 <label for="wipe_confirm">Confirmation</label>
94 <input type="text" id="wipe_confirm" name="confirm" placeholder="{{ community_slug }}" autocomplete="off" required>
95 </div>
96 <div class="form-actions">
97 <button type="submit" class="danger">Delete all chat messages now</button>
98 </div>
99 </form>
100 </div>
101 </div>
102
103 <div class="settings-section">
104 <h3>Categories</h3>
105 {% if categories.is_empty() %}
106 <div class="empty-state">No categories yet.</div>
107 {% else %}
108 <table class="settings-table">
109 <thead>
110 <tr>
111 <th>Name</th>
112 <th>Slug</th>
113 <th>Order</th>
114 <th>Actions</th>
115 </tr>
116 </thead>
117 <tbody>
118 {% for cat in categories %}
119 <tr>
120 <td>
121 <span class="settings-cat-name">{{ cat.name }}</span>
122 {% if let Some(desc) = cat.description %}
123 <span class="settings-cat-desc">{{ desc }}</span>
124 {% endif %}
125 </td>
126 <td class="settings-mono">{{ cat.slug }}</td>
127 <td class="settings-mono">{{ cat.sort_order }}</td>
128 <td class="settings-actions">
129 <a href="/p/{{ community_slug }}/settings/categories/{{ cat.id }}/edit" class="post-action-link">edit</a>
130 {% if !cat.is_first %}
131 <form method="post" action="/p/{{ community_slug }}/settings/categories/{{ cat.id }}/move" class="form-inline">
132 {% include "partials/csrf_input.html" %}
133 <input type="hidden" name="direction" value="up">
134 <button type="submit" class="post-action-link">up</button>
135 </form>
136 {% endif %}
137 {% if !cat.is_last %}
138 <form method="post" action="/p/{{ community_slug }}/settings/categories/{{ cat.id }}/move" class="form-inline">
139 {% include "partials/csrf_input.html" %}
140 <input type="hidden" name="direction" value="down">
141 <button type="submit" class="post-action-link">down</button>
142 </form>
143 {% endif %}
144 </td>
145 </tr>
146 {% endfor %}
147 </tbody>
148 </table>
149 {% endif %}
150
151 <h3 class="section-heading-top">Add Category</h3>
152 <div class="form-container">
153 <form method="post" action="/p/{{ community_slug }}/settings/categories/new">
154 {% include "partials/csrf_input.html" %}
155 <div class="form-row">
156 <div class="form-group">
157 <label for="cat-name">Name</label>
158 <input type="text" id="cat-name" name="name" required>
159 </div>
160 <div class="form-group">
161 <label for="cat-slug">Slug</label>
162 <input type="text" id="cat-slug" name="slug" placeholder="lowercase-with-hyphens" required>
163 </div>
164 </div>
165 <div class="form-group">
166 <label for="cat-description">Description (optional)</label>
167 <textarea id="cat-description" name="description" class="textarea-short" maxlength="1024"></textarea>
168 </div>
169 <div class="form-actions">
170 <button type="submit" class="primary">Add Category</button>
171 </div>
172 </form>
173 </div>
174 </div>
175
176 <div class="settings-section">
177 <h3>Tags</h3>
178 {% if tags.is_empty() %}
179 <div class="empty-state">No tags yet.</div>
180 {% else %}
181 <table class="settings-table">
182 <thead>
183 <tr>
184 <th>Name</th>
185 <th>Slug</th>
186 <th>Actions</th>
187 </tr>
188 </thead>
189 <tbody>
190 {% for tag in tags %}
191 <tr>
192 <td>{{ tag.name }}</td>
193 <td class="settings-mono">{{ tag.slug }}</td>
194 <td class="settings-actions">
195 <form method="post" action="/p/{{ community_slug }}/settings/tags/delete" class="form-inline" data-confirm="Delete this tag?">
196 {% include "partials/csrf_input.html" %}
197 <input type="hidden" name="tag_id" value="{{ tag.id }}">
198 <button type="submit" class="post-action-link post-action-delete">delete</button>
199 </form>
200 </td>
201 </tr>
202 {% endfor %}
203 </tbody>
204 </table>
205 {% endif %}
206
207 <h3 class="section-heading-top">Add Tag</h3>
208 <div class="form-container">
209 <form method="post" action="/p/{{ community_slug }}/settings/tags/new">
210 {% include "partials/csrf_input.html" %}
211 <div class="form-row">
212 <div class="form-group">
213 <label for="tag-name">Name</label>
214 <input type="text" id="tag-name" name="name" required>
215 </div>
216 <div class="form-group">
217 <label for="tag-slug">Slug</label>
218 <input type="text" id="tag-slug" name="slug" placeholder="lowercase-with-hyphens" required>
219 </div>
220 </div>
221 <div class="form-actions">
222 <button type="submit" class="primary">Add Tag</button>
223 </div>
224 </form>
225 </div>
226 </div>
227 </div>
228 {% endblock %}
229