45 lines
2.4 KiB
HTML
45 lines
2.4 KiB
HTML
{%- from 'common/macros.html' import subheader, sortable_list, sortable_list_item -%}
|
|
{%- macro collection_item(name='', can_delete=true, id=-1, thread_count=0, post_count=0) -%}
|
|
<input name="name[]" type="text" autocomplete="off" value="{{name}}" required maxlength=60 placeholder="Collection name">
|
|
<input type="hidden" name="id[]" value="{{ 'new' if id == -1 else id}}" autocomplete="off">
|
|
<span>{{thread_count}} {{'thread' | pluralize(num=thread_count)}}, {{post_count}} {{'post' | pluralize(num=post_count)}} </span>
|
|
{%- if not can_delete -%}
|
|
<i>Default collection</i>
|
|
{%- else -%}
|
|
<button type="button" class="critical" data-s="deleteCollection">Delete</button>
|
|
{%- endif -%}
|
|
{%- endmacro -%}
|
|
{%- extends 'base.html' -%}
|
|
{%- block title -%}managing bookmark collections{%- endblock -%}
|
|
{%- block content -%}
|
|
<bitty-8 data-connect="/static/js/bits/collections-editor.js"></bitty-8>
|
|
{%- set sh -%}
|
|
<span class="js-only" data-r="enhance">
|
|
Drag collections to reoder them. You cannot move or remove the default collection, but you can rename it.
|
|
</span>
|
|
<div data-r="enhanceHide">This page requires JS enabled to work correctly.</div>
|
|
{%- endset -%}
|
|
{%- call() subheader('Manage bookmark collections', sh) -%}
|
|
<fieldset class="plank even no-shadow minimal thread-actions js-only" data-r="enhance">
|
|
<legend>Actions</legend>
|
|
<button data-s="addCollection">Add new collection</button>
|
|
<input type="submit" class="alt" value="Save collections" form="collections-form">
|
|
</fieldset>
|
|
{%- endcall -%}
|
|
<form class="plank" method="POST" id="collections-form">
|
|
<input type="hidden" autocomplete="off" name="deleted_ids" value="" data-r="countDeletedCollection">
|
|
{%- call() sortable_list(attr={'data-r': 'addCollection'}) -%}
|
|
{%- for collection in collections -%}
|
|
{%- call() sortable_list_item(key='bc', immovable=collection.is_default == 1, attr={'data-r': 'deleteCollection', 'data-id': collection.id}) -%}
|
|
{{ collection_item(name=collection.name, can_delete=collection.is_default != 1, thread_count=collection.get_threads_count(), post_count=collection.get_posts_count(), id=collection.id) }}
|
|
{%- endcall -%}
|
|
{%- endfor -%}
|
|
{%- endcall -%}
|
|
</form>
|
|
<script type="text/html" data-template="collectionItem">
|
|
{%- call() sortable_list_item(key='bc', attr={'data-r': 'deleteCollection', 'data-id': 'new'}) -%}
|
|
{{- collection_item() -}}
|
|
{%- endcall -%}
|
|
</script>
|
|
{%- endblock -%}
|