2023-08-14 22:48:50 +02:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
{% if collection %}
|
|
|
|
{{ _("Edit") }} - {{ collection.title }}
|
|
|
|
{% else %}
|
|
|
|
{{ _("New Collection") }}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
2023-08-19 02:25:13 +02:00
|
|
|
{% block scriptextra %}
|
2023-08-25 21:49:17 +02:00
|
|
|
<script src="/static/libs/jquery-ui.min.js?v=2"></script>
|
2023-08-22 20:58:43 +02:00
|
|
|
<script src="/static/collection_editor.js?v=8"></script>
|
2023-08-19 02:25:13 +02:00
|
|
|
{% endblock %}
|
|
|
|
|
2023-08-14 22:48:50 +02:00
|
|
|
{% block content %}
|
2023-08-16 01:52:10 +02:00
|
|
|
{% from "macros/forms.html" import render_field, render_submit_field, render_checkbox_field, render_field_prefix_button %}
|
2023-08-14 22:48:50 +02:00
|
|
|
<form method="POST" action="" enctype="multipart/form-data">
|
2023-08-22 20:58:43 +02:00
|
|
|
{{ render_submit_field(form.submit, class_="btn btn-primary float-end") }}
|
2023-08-14 22:48:50 +02:00
|
|
|
<h1>{{ self.title() }}</h1>
|
|
|
|
|
|
|
|
{{ form.hidden_tag() }}
|
2023-08-16 01:52:10 +02:00
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
{{ render_field(form.title, class_="col-sm-6") }}
|
|
|
|
{% if form.name %}
|
|
|
|
{{ render_field_prefix_button(form.name, class_="col-sm-6", pattern="[a-z0-9_]+",
|
|
|
|
prefix="/collections/" + collection.author.username + "/",
|
|
|
|
hint=_("Users won't be redirected when going to the old URL")) }}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
|
2023-08-14 22:48:50 +02:00
|
|
|
{{ render_field(form.short_description) }}
|
|
|
|
{{ render_checkbox_field(form.private, class_="my-3") }}
|
2023-08-19 03:43:38 +02:00
|
|
|
{% if collection %}
|
|
|
|
{{ render_field(form.long_description, fieldclass="form-control markdown") }}
|
|
|
|
{% endif %}
|
2023-08-14 22:48:50 +02:00
|
|
|
|
2023-08-22 20:58:43 +02:00
|
|
|
{% if collection %}
|
2023-08-14 22:48:50 +02:00
|
|
|
<h2>{{ _("Packages") }}</h2>
|
2023-08-19 03:31:40 +02:00
|
|
|
<div class="mb-5">
|
2023-08-22 20:58:43 +02:00
|
|
|
<label for="add_package" class="visually-hidden">Add package</label>
|
2023-08-19 03:31:40 +02:00
|
|
|
<input id="add_package" type="search" class="form-control d-none" placeholder="Add package">
|
|
|
|
<p id="add_package_empty" class="mt-2" style="display: none;">
|
|
|
|
<i>{{ _("No results") }}</i>
|
|
|
|
</p>
|
|
|
|
<div id="add_package_results" class="list-group"></div>
|
|
|
|
</div>
|
2023-08-20 23:51:21 +02:00
|
|
|
<div id="package_list" class="sortable">
|
2023-08-19 03:31:40 +02:00
|
|
|
{% for item in collection.items %}
|
|
|
|
{% set package = item.package %}
|
2023-08-20 23:51:21 +02:00
|
|
|
<article class="card my-3" data-id="{{ package.get_id() }}">
|
2023-08-19 03:31:40 +02:00
|
|
|
<div class="card-body">
|
2023-08-20 23:51:21 +02:00
|
|
|
<div class="row">
|
2023-08-22 20:58:43 +02:00
|
|
|
<div class="col-auto text-muted pe-2">
|
2023-08-20 23:51:21 +02:00
|
|
|
<i class="fas fa-bars"></i>
|
|
|
|
</div>
|
|
|
|
<div class="col">
|
2023-08-22 20:58:43 +02:00
|
|
|
<button class="btn btn-sm btn-danger remove-package float-end"
|
2023-08-20 23:51:21 +02:00
|
|
|
type="button" aria-label="{{ _('Remove') }}">
|
|
|
|
<i class="fas fa-trash"></i>
|
|
|
|
</button>
|
|
|
|
<h5>
|
|
|
|
<a href="{{ package.get_url('packages.view') }}" target="_blank">
|
|
|
|
{{ _("%(title)s by %(author)s", title=package.title, author=package.author.display_name) }}
|
|
|
|
</a>
|
|
|
|
</h5>
|
|
|
|
<p class="text-muted">
|
|
|
|
{{ package.short_desc }}
|
|
|
|
</p>
|
|
|
|
{{ form.package_ids[loop.index - 1]() }}
|
|
|
|
{{ form.package_removed[loop.index - 1]() }}
|
2023-08-22 20:58:43 +02:00
|
|
|
{{ render_field(form.descriptions[loop.index - 1], hint=_("You can replace the description with your own"), no_class=True) }}
|
2023-08-20 23:51:21 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-08-19 03:31:40 +02:00
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
2023-08-20 23:51:21 +02:00
|
|
|
{{ form.order() }}
|
2023-08-14 22:48:50 +02:00
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="mt-5">
|
|
|
|
{{ render_submit_field(form.submit) }}
|
|
|
|
</div>
|
2023-08-19 03:31:40 +02:00
|
|
|
<span id="confirm_delete" class="d-none">
|
|
|
|
{{ _("Are you sure you want to remove {title}?") }}
|
|
|
|
</span>
|
2023-08-14 22:48:50 +02:00
|
|
|
</form>
|
|
|
|
{% endblock %}
|