2016-10-26 17:21:19 +00:00
|
|
|
{% extends "core/base.jinja" %}
|
|
|
|
|
2023-03-30 12:38:40 +00:00
|
|
|
{%- block additional_css -%}
|
2024-11-19 15:19:13 +00:00
|
|
|
<link defer rel="stylesheet" href="{{ static('bundled/core/components/ajax-select-index.css') }}">
|
2024-10-18 21:50:04 +00:00
|
|
|
<link defer rel="stylesheet" href="{{ static('core/components/ajax-select.scss') }}">
|
|
|
|
<link defer rel="stylesheet" href="{{ static('sas/css/picture.scss') }}">
|
2023-03-30 12:38:40 +00:00
|
|
|
{%- endblock -%}
|
|
|
|
|
2024-08-01 17:02:29 +00:00
|
|
|
{%- block additional_js -%}
|
2024-11-19 14:16:23 +00:00
|
|
|
<script type="module" src="{{ static('bundled/core/components/ajax-select-index.ts') }}"></script>
|
|
|
|
<script type="module" src="{{ static("bundled/sas/viewer-index.ts") }}"></script>
|
2024-08-01 17:02:29 +00:00
|
|
|
{%- endblock -%}
|
|
|
|
|
2016-10-26 17:21:19 +00:00
|
|
|
{% block title %}
|
2024-07-23 22:16:31 +00:00
|
|
|
{% trans %}SAS{% endtrans %}
|
2016-10-26 17:21:19 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2024-08-08 15:51:33 +00:00
|
|
|
{% from "sas/macros.jinja" import print_path %}
|
2016-11-19 16:19:00 +00:00
|
|
|
|
2016-10-26 17:21:19 +00:00
|
|
|
{% block content %}
|
2024-09-03 18:15:37 +00:00
|
|
|
<main x-data="picture_viewer">
|
|
|
|
<code>
|
2024-10-08 15:14:22 +00:00
|
|
|
<a href="{{ url('sas:main') }}">SAS</a> / {{ print_path(album) }} <span x-text="currentPicture.name"></span>
|
2024-09-03 18:15:37 +00:00
|
|
|
</code>
|
2024-07-23 22:16:31 +00:00
|
|
|
|
2024-09-03 18:15:37 +00:00
|
|
|
<br>
|
2024-07-23 22:16:31 +00:00
|
|
|
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="title">
|
2024-10-08 15:14:22 +00:00
|
|
|
<h3 x-text="currentPicture.name"></h3>
|
|
|
|
<h4 x-text="`${pictures.indexOf(currentPicture) + 1 } / ${pictures.length}`"></h4>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
|
|
|
<br>
|
2023-03-30 12:38:40 +00:00
|
|
|
|
2024-10-08 15:14:22 +00:00
|
|
|
<template x-if="!currentPicture.is_moderated">
|
2024-10-13 22:45:31 +00:00
|
|
|
<div class="alert alert-red" @click="console.log(currentPicture)">
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="alert-main">
|
2024-10-13 22:45:31 +00:00
|
|
|
<template x-if="currentPicture.asked_for_removal">
|
|
|
|
<h3 class="alert-title">{% trans %}Asked for removal{% endtrans %}</h3>
|
2024-09-03 18:15:37 +00:00
|
|
|
</template>
|
|
|
|
<p>
|
|
|
|
{% trans trimmed %}
|
|
|
|
This picture can be viewed only by root users and by SAS admins.
|
|
|
|
It will be hidden to other users until it has been moderated.
|
|
|
|
{% endtrans %}
|
|
|
|
</p>
|
2024-10-13 22:45:31 +00:00
|
|
|
<template x-if="currentPicture.asked_for_removal">
|
|
|
|
<div>
|
|
|
|
<h5 @click="console.log(currentPicture.moderationRequests)">
|
|
|
|
{% trans %}The following issues have been raised:{% endtrans %}
|
|
|
|
</h5>
|
|
|
|
<template x-for="req in (currentPicture.moderationRequests ?? [])" :key="req.id">
|
|
|
|
<div>
|
|
|
|
<h6
|
|
|
|
x-text="`${req.author.first_name} ${req.author.last_name}`"
|
|
|
|
></h6>
|
|
|
|
<i x-text="Intl.DateTimeFormat(
|
|
|
|
'{{ LANGUAGE_CODE }}',
|
|
|
|
{dateStyle: 'long', timeStyle: 'short'}
|
|
|
|
).format(new Date(req.created_at))"></i>
|
|
|
|
<blockquote x-text="`> ${req.reason}`"></blockquote>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
2024-10-13 22:45:31 +00:00
|
|
|
<div class="alert-aside">
|
|
|
|
<button class="btn btn-blue" @click="moderatePicture()">
|
|
|
|
{% trans %}Moderate{% endtrans %}
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-red" @click.prevent="deletePicture()">
|
|
|
|
{% trans %}Delete{% endtrans %}
|
|
|
|
</button>
|
2024-10-08 15:14:22 +00:00
|
|
|
<p x-show="!!moderationError" x-text="moderationError"></p>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
2024-07-23 22:16:31 +00:00
|
|
|
</div>
|
2024-09-03 18:15:37 +00:00
|
|
|
</template>
|
2024-07-23 22:16:31 +00:00
|
|
|
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="container" id="pict">
|
|
|
|
<div class="main">
|
2024-10-08 15:14:22 +00:00
|
|
|
<div class="photo" :aria-busy="currentPicture.imageLoading">
|
2024-09-16 16:14:37 +00:00
|
|
|
<img
|
2024-10-08 15:14:22 +00:00
|
|
|
:src="currentPicture.compressed_url"
|
|
|
|
:alt="currentPicture.name"
|
2024-09-16 16:14:37 +00:00
|
|
|
id="main-picture"
|
2024-10-08 15:14:22 +00:00
|
|
|
x-ref="mainPicture"
|
2024-09-16 16:14:37 +00:00
|
|
|
/>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
2024-07-23 22:16:31 +00:00
|
|
|
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="general">
|
|
|
|
<div class="infos">
|
|
|
|
<h5>{% trans %}Infos{% endtrans %}</h5>
|
2023-03-30 12:38:40 +00:00
|
|
|
<div>
|
2024-07-23 22:16:31 +00:00
|
|
|
<div>
|
2024-09-03 18:15:37 +00:00
|
|
|
<span>{% trans %}Date: {% endtrans %}</span>
|
|
|
|
<span
|
|
|
|
x-text="Intl.DateTimeFormat(
|
|
|
|
'{{ LANGUAGE_CODE }}', {dateStyle: 'long'}
|
2024-10-08 15:14:22 +00:00
|
|
|
).format(new Date(currentPicture.date))"
|
2024-09-03 18:15:37 +00:00
|
|
|
>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span>{% trans %}Owner: {% endtrans %}</span>
|
2024-10-08 15:14:22 +00:00
|
|
|
<a :href="currentPicture.owner.profile_url" x-text="currentPicture.owner.display_name"></a>
|
2024-07-23 22:16:31 +00:00
|
|
|
</div>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
2024-07-23 22:16:31 +00:00
|
|
|
</div>
|
2023-03-30 12:38:40 +00:00
|
|
|
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="tools">
|
|
|
|
<h5>{% trans %}Tools{% endtrans %}</h5>
|
2024-07-23 22:16:31 +00:00
|
|
|
<div>
|
2024-09-03 18:15:37 +00:00
|
|
|
<div>
|
2024-10-08 15:14:22 +00:00
|
|
|
<a class="text" :href="currentPicture.full_size_url">
|
2024-09-03 18:15:37 +00:00
|
|
|
{% trans %}HD version{% endtrans %}
|
|
|
|
</a>
|
|
|
|
<br>
|
2024-10-10 16:53:49 +00:00
|
|
|
<a class="text danger" :href="`/sas/picture/${currentPicture.id}/report`">
|
|
|
|
{% trans %}Ask for removal{% endtrans %}
|
|
|
|
</a>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
|
|
|
<div class="buttons">
|
2024-10-08 15:14:22 +00:00
|
|
|
<a class="button" :href="`/sas/picture/${currentPicture.id}/edit/`"><i class="fa-regular fa-pen-to-square edit-action"></i></a>
|
2024-09-17 13:08:19 +00:00
|
|
|
<a class="button" href="?rotate_left"><i class="fa-solid fa-rotate-left"></i></a>
|
|
|
|
<a class="button" href="?rotate_right"><i class="fa-solid fa-rotate-right"></i></a>
|
2024-09-03 18:15:37 +00:00
|
|
|
</div>
|
2023-03-30 12:38:40 +00:00
|
|
|
</div>
|
2024-07-23 22:16:31 +00:00
|
|
|
</div>
|
2023-03-30 12:38:40 +00:00
|
|
|
</div>
|
2024-07-23 22:16:31 +00:00
|
|
|
</div>
|
2023-03-30 12:38:40 +00:00
|
|
|
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="subsection">
|
|
|
|
<div class="navigation">
|
|
|
|
<div id="prev" class="clickable">
|
2024-10-08 15:14:22 +00:00
|
|
|
<template x-if="previousPicture">
|
2024-09-03 18:15:37 +00:00
|
|
|
<div
|
2024-10-08 15:14:22 +00:00
|
|
|
@keyup.left.window="currentPicture = previousPicture"
|
|
|
|
@click="currentPicture = previousPicture"
|
2024-09-03 18:15:37 +00:00
|
|
|
>
|
2024-10-08 15:14:22 +00:00
|
|
|
<img :src="previousPicture.thumb_url" alt="{% trans %}Previous picture{% endtrans %}"/>
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="overlay">←</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<div id="next" class="clickable">
|
2024-10-08 15:14:22 +00:00
|
|
|
<template x-if="nextPicture">
|
2024-09-03 18:15:37 +00:00
|
|
|
<div
|
2024-10-08 15:14:22 +00:00
|
|
|
@keyup.right.window="currentPicture = nextPicture"
|
|
|
|
@click="currentPicture = nextPicture"
|
2024-09-03 18:15:37 +00:00
|
|
|
>
|
2024-10-08 15:14:22 +00:00
|
|
|
<img :src="nextPicture.thumb_url" alt="{% trans %}Previous picture{% endtrans %}"/>
|
2024-09-03 18:15:37 +00:00
|
|
|
<div class="overlay">→</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
2016-11-19 16:19:00 +00:00
|
|
|
</div>
|
2024-09-03 18:15:37 +00:00
|
|
|
|
|
|
|
<div class="tags">
|
|
|
|
<h5>{% trans %}People{% endtrans %}</h5>
|
|
|
|
{% if user.was_subscribed %}
|
2024-10-08 15:14:22 +00:00
|
|
|
<form @submit.prevent="submitIdentification" x-show="!!selector">
|
2024-10-18 21:26:04 +00:00
|
|
|
<user-ajax-select
|
2024-10-16 00:22:27 +00:00
|
|
|
x-ref="search"
|
|
|
|
multiple
|
2024-10-18 21:26:04 +00:00
|
|
|
delay="300"
|
|
|
|
placeholder="{%- trans -%}Identify users on pictures{%- endtrans -%}"
|
|
|
|
></user-ajax-select>
|
2024-09-03 18:15:37 +00:00
|
|
|
<input type="submit" value="{% trans %}Go{% endtrans %}"/>
|
|
|
|
</form>
|
2024-07-23 22:16:31 +00:00
|
|
|
{% endif %}
|
2024-09-03 18:15:37 +00:00
|
|
|
<ul>
|
2024-09-16 16:14:37 +00:00
|
|
|
<template
|
2024-10-08 15:14:22 +00:00
|
|
|
x-for="identification in (currentPicture.identifications || [])"
|
2024-09-16 16:14:37 +00:00
|
|
|
:key="identification.id"
|
|
|
|
>
|
2024-09-03 18:15:37 +00:00
|
|
|
<li>
|
|
|
|
<a class="user" :href="identification.user.profile_url">
|
|
|
|
<img class="profile-pic" :src="identification.user.profile_pict" alt="image de profil"/>
|
|
|
|
<span x-text="identification.user.display_name"></span>
|
|
|
|
</a>
|
2024-10-08 15:14:22 +00:00
|
|
|
<template x-if="canBeRemoved(identification)">
|
|
|
|
<a class="delete clickable" @click="removeIdentification(identification)"><i class="fa fa-times fa-xl delete-action"></i></a>
|
2024-09-03 18:15:37 +00:00
|
|
|
</template>
|
|
|
|
</li>
|
|
|
|
</template>
|
2024-10-08 15:14:22 +00:00
|
|
|
<template x-if="currentPicture.identificationsLoading">
|
2024-09-03 18:15:37 +00:00
|
|
|
{# shadow element that exists only to put the loading wheel below
|
|
|
|
the list of identified people #}
|
|
|
|
<li class="loader" aria-busy="true"></li>
|
|
|
|
</template>
|
|
|
|
</ul>
|
2024-07-23 22:16:31 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-19 16:19:00 +00:00
|
|
|
</div>
|
2024-09-03 18:15:37 +00:00
|
|
|
</main>
|
2016-10-26 17:21:19 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
2016-11-19 16:19:00 +00:00
|
|
|
{% block script %}
|
2024-07-23 22:16:31 +00:00
|
|
|
{{ super() }}
|
|
|
|
<script>
|
2024-10-09 19:46:56 +00:00
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
|
|
loadViewer({
|
|
|
|
albumId: {{ album.id }} ,
|
|
|
|
albumUrl: "{{ album.get_absolute_url() }}",
|
|
|
|
firstPictureId: {{ picture.id }}, {# id of the first picture to show after page load #}
|
|
|
|
userId: {{ user.id }},
|
|
|
|
userIsSasAdmin: {{ (user.is_root or user.is_in_group(pk = settings.SITH_GROUP_SAS_ADMIN_ID))|tojson }}
|
|
|
|
});
|
|
|
|
})
|
2024-07-23 22:16:31 +00:00
|
|
|
</script>
|
2016-11-19 16:19:00 +00:00
|
|
|
{% endblock %}
|