apply review comments

This commit is contained in:
thomas girod 2024-09-10 22:55:39 +02:00
parent 727e5cb199
commit a2a858262a
6 changed files with 12 additions and 9 deletions

View File

@ -246,7 +246,11 @@ function select_item_builder(picture_getter) {
const picture = const picture =
typeof picture_getter === "function" ? picture_getter(item) : null; typeof picture_getter === "function" ? picture_getter(item) : null;
const img_html = picture const img_html = picture
? `<img src="${picture_getter(item)}" alt="item.text"/>` ? `<img
src="${picture_getter(item)}"
alt="${item.text}"
onerror="this.src = '/static/core/img/unknown.jpg'"
/>`
: ""; : "";
return $(`<div class="select-item"> return $(`<div class="select-item">

View File

@ -11,7 +11,7 @@
<link rel="stylesheet" href="{{ scss('core/markdown.scss') }}"> <link rel="stylesheet" href="{{ scss('core/markdown.scss') }}">
<link rel="stylesheet" href="{{ scss('core/header.scss') }}"> <link rel="stylesheet" href="{{ scss('core/header.scss') }}">
<link rel="stylesheet" href="{{ scss('core/navbar.scss') }}"> <link rel="stylesheet" href="{{ scss('core/navbar.scss') }}">
<link rel="stylesheet" href="{{ static('core/select2/select2.min.css') }}"> <link rel="stylesheet" href="{{ static('vendored/select2/select2.min.css') }}">
{% block jquery_css %} {% block jquery_css %}
{# Thile file is quite heavy (around 250kb), so declaring it in a block allows easy removal #} {# Thile file is quite heavy (around 250kb), so declaring it in a block allows easy removal #}
@ -25,7 +25,7 @@
<script src="{{ static('vendored/jquery/jquery-3.6.2.min.js') }}"></script> <script src="{{ static('vendored/jquery/jquery-3.6.2.min.js') }}"></script>
<!-- Put here to always have acces to those functions on django widgets --> <!-- Put here to always have acces to those functions on django widgets -->
<script src="{{ static('core/js/script.js') }}"></script> <script src="{{ static('core/js/script.js') }}"></script>
<script defer src="{{ static('core/select2/select2.min.js') }}"></script> <script defer src="{{ static('vendored/select2/select2.min.js') }}"></script>
<script defer src="{{ static('core/js/sith-select2.js') }}"></script> <script defer src="{{ static('core/js/sith-select2.js') }}"></script>

View File

@ -4,7 +4,6 @@
* @property {UserProfile} user The identified user * @property {UserProfile} user The identified user
*/ */
document.addEventListener("alpine:init", () => { document.addEventListener("alpine:init", () => {
Alpine.data("picture_viewer", () => ({ Alpine.data("picture_viewer", () => ({
/** /**
@ -141,7 +140,7 @@ document.addEventListener("alpine:init", () => {
}, },
async delete_picture() { async delete_picture() {
const res = await fetch(`/api/sas/picture/${this.current_picture}/`, { const res = await fetch(`/api/sas/picture/${this.current_picture.id}/`, {
method: "DELETE", method: "DELETE",
}); });
if (!res.ok) { if (!res.ok) {

View File

@ -5,7 +5,7 @@
{%- endblock -%} {%- endblock -%}
{%- block additional_js -%} {%- block additional_js -%}
<script defer src="{{ static("sas/js/picture.js") }}"></script> <script defer src="{{ static("sas/js/viewer.js") }}"></script>
{%- endblock -%} {%- endblock -%}
{% block title %} {% block title %}