add sorting topics view
This commit is contained in:
19
views/mod/sort-topics.etlua
Normal file
19
views/mod/sort-topics.etlua
Normal file
@ -0,0 +1,19 @@
|
||||
<div class="darkbg settings-container">
|
||||
<% if infobox then %>
|
||||
<% render("views.common.infobox", infobox) %>
|
||||
<% end %>
|
||||
<h1>Change topics order</h1>
|
||||
<p>Drag topic titles to reoder them. Press submit when done. The topics will appear to users in the order set here.</p>
|
||||
<form method="post" id=topics-container>
|
||||
<% for _, topic in ipairs(topics) do %>
|
||||
<div draggable="true" class="draggable-topic" ondragover="dragOver(event)" ondragstart="dragStart(event)" ondragend="dragEnd()">
|
||||
<div class="thread-title"><%= topic.name %></div>
|
||||
<div><%= topic.description %></div>
|
||||
<input type="hidden" name="<%= topic.id %>" value="<%= topic.sort_order %>" class="topic-input">
|
||||
</div>
|
||||
<% end %>
|
||||
<input type=submit value="Save order">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/sort-topics.js"></script>
|
@ -2,6 +2,7 @@
|
||||
<h1 class="thread-title">All topics</h1>
|
||||
<% if me:is_mod() then %>
|
||||
<a class="linkbutton" href="<%= url_for("topic_create") %>">Create new topic</a>
|
||||
<a class="linkbutton" href="<%= url_for("sort_topics") %>">Sort topics</a>
|
||||
<% end %>
|
||||
</nav>
|
||||
|
||||
|
Reference in New Issue
Block a user