add topic sorting & js to support it

This commit is contained in:
2026-05-28 04:19:42 +03:00
parent 303750a281
commit 6b7a0e7a17
8 changed files with 241 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
{%- from 'common/macros.html' import subheader, babycode_editor_component -%}
{%- from 'common/macros.html' import subheader, babycode_editor_component, sortable_list, sortable_list_item -%}
{%- extends 'base.html' -%}
{%- block title -%}settings{%- endblock -%}
{%- block content -%}
@@ -19,5 +19,18 @@
</fieldset>
<fieldset class="plank" id="sort-topics">
<legend>Sort topics</legend>
<p>Drag topics around to reorder them. Press "Save order" when done.</p>
<form method="POST" action="{{url_for('mod.sort_topics')}}">
<input type="submit" value="Save order">
{%- call() sortable_list() -%}
{%- for topic in topics -%}
{%- call() sortable_list_item(key="topics") -%}
<h2 class="info">{{ topic.name }}</h2>
<div>{{topic.description}}</div>
<input type="hidden" name="topics[]" value="{{ topic.id }}">
{%- endcall -%}
{%- endfor -%}
{%- endcall -%}
</form>
</fieldset>
{%- endblock -%}