contentdb/app/templates/packages/screenshots.html

151 lines
4.3 KiB
HTML
Raw Normal View History

2021-05-04 04:15:26 +02:00
{% extends "packages/package_base.html" %}
2020-12-06 04:35:25 +01:00
{% block title %}
2022-01-08 00:27:00 +01:00
{{ _("Screenshots") }} - {{ package.title }}
2020-12-06 04:35:25 +01:00
{% endblock %}
{% block content %}
{% if package.check_perm(current_user, "ADD_SCREENSHOTS") %}
2023-08-22 20:58:43 +02:00
<a href="{{ package.get_url('packages.create_screenshot') }}" class="btn btn-primary float-end">
<i class="fas fa-plus me-1"></i>
2020-12-06 04:35:25 +01:00
{{ _("Add Image") }}
</a>
{% endif %}
2022-01-08 00:27:00 +01:00
<h2 class="mt-0">{{ _("Screenshots") }}</h2>
2020-12-06 04:35:25 +01:00
<ul class="list-group sortable">
2023-06-01 18:48:59 +02:00
{% set screenshots = package.screenshots.all() %}
{% for ss in screenshots %}
{% if ss.approved or package.check_perm(current_user, "ADD_SCREENSHOTS") %}
2020-12-06 04:35:25 +01:00
<li class="list-group-item" data-id="{{ ss.id }}">
<div class="row">
2023-08-22 20:58:43 +02:00
<div class="col-auto text-muted pe-2">
2020-12-06 04:35:25 +01:00
<i class="fas fa-bars"></i>
</div>
<div class="col-auto">
<img class="img-fluid" style="max-height: 64px;" src="{{ ss.get_thumb_url() }}" />
2020-12-06 04:35:25 +01:00
</div>
<div class="col">
2020-12-06 04:35:25 +01:00
{{ ss.title }}
2022-01-26 03:51:40 +01:00
<div class="mt-1 text-muted">
{{ ss.width }} x {{ ss.height }}
{% if ss.is_low_res() %}
{% if ss.is_very_small() %}
2023-08-22 20:58:43 +02:00
<span class="badge bg-danger ms-3">
2022-01-26 03:51:40 +01:00
{{ _("Way too small") }}
</span>
{% elif ss.is_too_small() %}
2023-08-22 20:58:43 +02:00
<span class="badge bg-warning ms-3">
2022-01-26 03:51:40 +01:00
{{ _("Too small") }}
</span>
{% else %}
2023-08-22 20:58:43 +02:00
<span class="badge bg-secondary ms-3">
2022-01-26 03:51:40 +01:00
{{ _("Not HD") }}
</span>
{% endif %}
{% endif %}
{% if not ss.approved %}
2023-08-22 20:58:43 +02:00
<span class="ms-3">
2022-01-26 03:51:40 +01:00
{{ _("Awaiting approval") }}
</span>
{% endif %}
</div>
</div>
2023-08-22 20:58:43 +02:00
<form action="{{ ss.get_delete_url() }}" method="POST" class="col-auto text-end" role="form">
2020-12-06 05:30:47 +01:00
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<a class="btn btn-sm btn-primary" href="{{ ss.get_edit_url() }}">
2021-02-28 06:16:15 +01:00
<i class="fas fa-pen"></i>
2020-12-06 04:35:25 +01:00
</a>
2023-08-22 20:58:43 +02:00
<button type="submit" class="btn btn-sm btn-danger ms-2">
2020-12-06 05:30:47 +01:00
<i class="fas fa-trash"></i>
</button>
</form>
2020-12-06 04:35:25 +01:00
</div>
</li>
{% endif %}
2020-12-06 05:07:51 +01:00
{% else %}
<li class="list-group-item">
2022-01-08 00:27:00 +01:00
<i>{{ _("No screenshots.") }}</i>
2020-12-06 05:07:51 +01:00
</li>
2020-12-06 04:35:25 +01:00
{% endfor %}
</ul>
2023-06-01 18:48:59 +02:00
{% if screenshots %}
<form action="" method="POST" class="form mt-4" role="form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="order" value="" />
<input type="submit" value="{{ _('Save Order') }}" class="btn btn-primary">
</form>
2020-12-06 04:35:25 +01:00
2023-06-01 18:48:59 +02:00
<noscript>
<p class="alert alert-warning mt-5">
{{ _("Reordering requires JavaScript.") }}
</p>
</noscript>
{% endif %}
<h2 id="client-preview">{{ _("Client Preview") }}</h2>
<p class="mb-4">
{{ _("The first screenshot in the list above will be the package thumbnail.") }}
</p>
<div class="client-preview d-flex flex-row align-items-center">
<img class="mt-thumb" src="{{ package.get_thumb_or_placeholder(1) }}" alt="{{ _('Thumbnail') }}">
2023-08-22 20:58:43 +02:00
<div class="flex-grow-1 desc align-self-stretch">
2023-06-01 18:48:59 +02:00
<p>
<span class="title">{{ package.title }}</span> by {{ package.author.username }}
</p>
<p>
{% if package.state.name == 'WORK_IN_PROGRESS' %}
Work in Progress.
{% endif %}
{{ package.short_desc }}
</p>
</div>
<div>
<img src="/static/minetest_client_buttons.png" alt="Install">
</div>
</div>
<h2>{{ _("Cover Image") }}</h2>
2023-06-01 18:48:59 +02:00
{% if screenshots %}
{% from "macros/forms.html" import render_submit_field, render_field %}
<form action="" method="POST" class="form" role="form">
{{ form.hidden_tag() }}
2023-06-01 18:48:59 +02:00
{{ render_field(form.cover_image, tabindex=220) }}
2023-06-01 18:48:59 +02:00
{{ render_submit_field(form.submit, tabindex=280) }}
</form>
{% else %}
<p class="text-muted">
<i>{{ _("No screenshots.") }}</i>
</p>
{% endif %}
<h2>{{ _("Videos") }}</h2>
<p>
{{ _("You can set a video on the Edit Details page") }}
</p>
2020-12-06 04:35:25 +01:00
{% endblock %}
{% block scriptextra %}
2023-08-25 21:49:17 +02:00
<script src="/static/libs/jquery-ui.min.js?v=2"></script>
2020-12-06 04:35:25 +01:00
<script>
function update() {
const elements = Array.from(document.getElementsByClassName("sortable")[0].children);
const ids = elements.map(x => x.dataset.id).filter(x => x);
$("input[name='order']").val(ids.join(","))
}
update();
$(function() {
$(".sortable").sortable({
update: update
});
});
</script>
{% endblock %}