From 75989e6a27431451effbedb725fb0ff2cbc07f4b Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Sun, 15 Sep 2024 20:58:20 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9place=20la=20modification=20de=20la=20mi?= =?UTF-8?q?niature=20dans=20un=20formulaire=20d=C3=A9di=C3=A9=20(#6613)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Transforme la miniature de tutoriel en bouton * Ajoute le formulaire pour modifier la miniature * Corrige les tests existants * Ajoute des tests pour la vue des miniatures * Ajoute l'inscription dans le journal d'événement * Change le style du bouton d'image * Cache l'image par défaut pour les fonds transparents --- assets/scss/layout/_content.scss | 68 ++++++++++ .../tutorialv2/events/descriptions.part.html | 3 + .../includes/headline/title.part.html | 19 ++- zds/tutorialv2/forms.py | 31 ----- zds/tutorialv2/models/events.py | 11 ++ zds/tutorialv2/signals.py | 4 + .../tests/tests_views/tests_content.py | 9 -- .../tests_views/tests_editthumbnailview.py | 126 ++++++++++++++++++ .../tests/tests_views/tests_published.py | 34 ++--- zds/tutorialv2/urls/urls_contents.py | 7 +- zds/tutorialv2/views/contents.py | 65 ++------- zds/tutorialv2/views/display/content.py | 2 + zds/tutorialv2/views/thumbnail.py | 106 +++++++++++++++ 13 files changed, 360 insertions(+), 125 deletions(-) create mode 100644 zds/tutorialv2/tests/tests_views/tests_editthumbnailview.py create mode 100644 zds/tutorialv2/views/thumbnail.py diff --git a/assets/scss/layout/_content.scss b/assets/scss/layout/_content.scss index c9f3864278..e67f4372b2 100644 --- a/assets/scss/layout/_content.scss +++ b/assets/scss/layout/_content.scss @@ -21,8 +21,76 @@ margin-bottom: $length-10; >.content-thumbnail-group { + flex-grow: 0; flex-shrink: 0; + + display:block; + height: $length-64; + width: $length-64; + margin-right: $length-10; + + background-size: contain; + + >.thumbnail { + width: 100%; + height: 100%; + border: $length-1 solid $grey-200; + box-sizing: border-box; + } + + >.edit-thumbnail { + display: block; + width: $length-32; + height: $length-32; + margin-top: calc($length-64/2 - $length-32/2); + margin-left: calc($length-64/2 - $length-32/2); + border-radius: $radius-round; + background-color: rgba($grey-200, 0.7); + &.with-thumbnail { + position: relative; + top: -$length-64; + } + &.with-placeholder{ + position: relative; + top: 0; + } + &::after { + content: " "; + display: block; + width: $length-16; + height: $length-16; + position: relative; + top: calc($length-32/2 - $length-16/2); + left: calc($length-32/2 - $length-16/2); + @include sprite; + @include sprite-position($edit-blue); + background-repeat: no-repeat; + } + transition: border-radius .005s ease-in-out; + &:hover { + border-radius: 0; + width: 100%; + height: 100%; + margin: 0; + &::after { + top: calc($length-64/2 - $length-16/2); + left: calc($length-64/2 - $length-16/2); + } + } + } + + &.article-illu { + background-image: url("/static/images/article-illu.png"); + } + + &.tutorial-illu { + background-image: url("/static/images/tutorial-illu.png"); + } + + &.opinion-illu { + background-image: url("/static/images/opinion-illu.png"); + } } >.content-title-and-subtitle-group { diff --git a/templates/tutorialv2/events/descriptions.part.html b/templates/tutorialv2/events/descriptions.part.html index 360720290a..af203e3430 100644 --- a/templates/tutorialv2/events/descriptions.part.html +++ b/templates/tutorialv2/events/descriptions.part.html @@ -57,6 +57,9 @@ {% endif %} +{% elif event.type == "thumbnail_management" %} + {{ event.performer }} a modifié la miniature du contenu. + {% elif event.type == "tags_management" %} {{ event.performer }} a modifié les tags du contenu. diff --git a/templates/tutorialv2/includes/headline/title.part.html b/templates/tutorialv2/includes/headline/title.part.html index 22e89e8753..8ec2bfdeac 100644 --- a/templates/tutorialv2/includes/headline/title.part.html +++ b/templates/tutorialv2/includes/headline/title.part.html @@ -1,12 +1,25 @@ {% load i18n %} {% load crispy_forms_tags %} +{% load captureas %} +