42 lines
2.6 KiB
HTML
42 lines
2.6 KiB
HTML
{% extends "base.html" %}
|
|
{% from 'common/macros.html' import sortable_list, sortable_list_item %}
|
|
{% block title %}managing bookmark collections{% endblock %}
|
|
{% block content %}
|
|
<div class="darkbg">
|
|
<h1>Manage bookmark collections</h1>
|
|
<p>Drag collections to reoder them. You cannot move or remove the default collection, but you can rename it.</p>
|
|
<bitty-7-0 data-connect="{{ '/static/js/bitties/pyrom-bitty.js' | cachebust }} CollectionsEditor">
|
|
<button type="button" data-send="addCollection">Add new collection</button>
|
|
{% set sorted_collections = collections | sort(attribute='sort_order') %}
|
|
{% macro collection_inner(collection) %}
|
|
<input type="text" class="collection-name" value="{{collection.name}}" placeholder="Collection name" required autocomplete="off" maxlength="60">
|
|
<div>{{ collection.get_threads_count() }} {{ "thread" | pluralize(num=collection.get_threads_count()) }}, {{ collection.get_posts_count() }} {{ "post" | pluralize(num=collection.get_posts_count()) }}</div>
|
|
{% if collection.is_default %}
|
|
<i>Default collection</i>
|
|
{% else %}
|
|
<button type="button" class="delete-button critical" data-send="deleteCollection">Delete</button>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
{% call() sortable_list(attr={'data-receive': 'addCollection' }) %}
|
|
{% call() sortable_list_item(key='collections', immovable=true, attr={'data-collection-id': sorted_collections[0].id, 'data-receive': 'deleteCollection getCollectionData testValidity'}) %}
|
|
{{ collection_inner(sorted_collections[0]) }}
|
|
{% endcall %}
|
|
{% for collection in sorted_collections[1:] %}
|
|
{% call() sortable_list_item(key='collections', attr={'data-collection-id': collection.id, 'data-receive': 'deleteCollection getCollectionData testValidity'}) %}
|
|
{{ collection_inner(collection) }}
|
|
{% endcall %}
|
|
{% endfor %}
|
|
{% endcall %}
|
|
<button data-use="saveCollections" type="button" id="save-button" data-submit-href="{{ url_for('api.manage_bookmark_collections', user_id=active_user.id) }}">Save</button>
|
|
</div>
|
|
<template id="new-collection-template">
|
|
{% call() sortable_list_item(key='collections', attr={'data-receive': 'deleteCollection getCollectionData testValidity'}) %}
|
|
<input type="text" class="collection-name" value="" placeholder="Collection name" required autocomplete="off" maxlength="60">
|
|
<div>0 threads, 0 posts</div>
|
|
<button type="button" class="delete-button critical" data-send="deleteCollection">Delete</button>
|
|
{% endcall %}
|
|
</template>
|
|
</bitty-7-0>
|
|
{#<script src="{{ "/static/js/manage-bookmark-collections.js" | cachebust }}"></script>#}
|
|
{% endblock %}
|