From 1cbb7131bec10f4b70b75b60c33e559ffa1cdb02 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 16 Sep 2014 16:46:32 +0200 Subject: [PATCH 01/71] Doc: Maj pour installer un git hook pre-comit --- doc/sphinx/source/install/install-linux.rst | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/sphinx/source/install/install-linux.rst b/doc/sphinx/source/install/install-linux.rst index 66d5af3efc..51a25fe987 100644 --- a/doc/sphinx/source/install/install-linux.rst +++ b/doc/sphinx/source/install/install-linux.rst @@ -84,3 +84,42 @@ Pour faire fonctionner ZdS dans son ensemble (ceci n'est pas obligatoire) vous p cabal update cabal install pandoc +Ajouter un hook de pre-commit a git pour tester flake +----------------------------------------------------- + +Afin de s'assurer qu'aucune erreur de mise en forme ne passe les commits, +il peut être utile de rajouter un hook de pre-commit à git. Un hook est un petit +programme qui sera exécuté avant une action particulière de git. En l'occurence nous +allons rajouter un hook qui s'executera juste avant la validation d'un commit. + +Pour cela, commencer par créer le fichier .git/hooks/pre-commit + +.. sourcecode:: bash + +touch .git/hooks/pre-commit + + +Puis rendez le executable via chmod + +.. sourcecode:: bash + +chmod +x .git/hooks/pre-commit + + +Il ne reste plus qu'à rajouter le contenu suivant dans ce fichier et dorénavant +le controle flake (pour le respect PEP) sera exécuté avant la validation du message de commit. +Ainsi, plus aucune erreur flake ne viendra vous embêter à posteriori et la base de code +restera propre et lisible au cours du temps ! + +.. sourcecode:: bash + +#!/bin/sh + +flake8 --exclude=migrations,urls.py,settings.py --max-line-length=120 zds + +# Store tests result +RESULT=$? + +[ $RESULT -ne 0 ] && exit 1 +exit 0 + From db06022ce963686bef0b9547ed4cb2b094bbef61 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 16 Sep 2014 22:17:27 +0200 Subject: [PATCH 02/71] =?UTF-8?q?Mise=20=C3=A0=20jour=20install=20Linux=20?= =?UTF-8?q?pour=20hook=20de=20pre-commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/sphinx/source/install/install-linux.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/sphinx/source/install/install-linux.rst b/doc/sphinx/source/install/install-linux.rst index 51a25fe987..cbfc8d720d 100644 --- a/doc/sphinx/source/install/install-linux.rst +++ b/doc/sphinx/source/install/install-linux.rst @@ -92,18 +92,11 @@ il peut être utile de rajouter un hook de pre-commit à git. Un hook est un pet programme qui sera exécuté avant une action particulière de git. En l'occurence nous allons rajouter un hook qui s'executera juste avant la validation d'un commit. -Pour cela, commencer par créer le fichier .git/hooks/pre-commit +Pour cela, commencer par créer eté éditer le fichier .git/hooks/pre-commit .. sourcecode:: bash -touch .git/hooks/pre-commit - - -Puis rendez le executable via chmod - -.. sourcecode:: bash - -chmod +x .git/hooks/pre-commit +vim .git/hooks/pre-commit Il ne reste plus qu'à rajouter le contenu suivant dans ce fichier et dorénavant @@ -123,3 +116,10 @@ RESULT=$? [ $RESULT -ne 0 ] && exit 1 exit 0 + +Enfin n'oubliez pas de le rendre executable via chmod + +.. sourcecode:: bash + +chmod +x .git/hooks/pre-commit + From a7e97ea867771d0b3868834a059d3f35a57d9d7e Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 16 Sep 2014 22:33:43 +0200 Subject: [PATCH 03/71] =?UTF-8?q?MiniFix-Plus=20de=20MP=20sur=20r=C3=A9sol?= =?UTF-8?q?ution=20vide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/article/views.py | 41 ++++++++++++++++++++++---------------- zds/forum/views.py | 46 +++++++++++++++++++++++-------------------- zds/tutorial/views.py | 46 +++++++++++++++++++++++-------------------- 3 files changed, 74 insertions(+), 59 deletions(-) diff --git a/zds/article/views.py b/zds/article/views.py index 0aa1f900c6..0221afd17d 100644 --- a/zds/article/views.py +++ b/zds/article/views.py @@ -1071,24 +1071,31 @@ def solve_alert(request): alert = get_object_or_404(Alert, pk=request.POST['alert_pk']) reaction = Reaction.objects.get(pk=alert.comment.id) - bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) - msg = (u'Bonjour {0},\n\nVous recevez ce message car vous avez ' - u'signalé le message de *{1}*, dans l\'article [{2}]({3}). ' - u'Votre alerte a été traitée par **{4}** et il vous a laissé ' - u'le message suivant :\n\n> {5}\n\nToute l\'équipe de ' - u'la modération vous remercie !'.format( - alert.author.username, - reaction.author.username, - reaction.article.title, - settings.SITE_URL + - reaction.get_absolute_url(), - request.user.username, - request.POST['text'])) - send_mp( - bot, [ - alert.author], u"Résolution d'alerte : {0}".format(reaction.article.title), "", msg, False) - alert.delete() + if request.POST["text"] != "": + bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) + msg = (u'Bonjour {0},\n\nVous recevez ce message car vous avez ' + u'signalé le message de *{1}*, dans l\'article [{2}]({3}). ' + u'Votre alerte a été traitée par **{4}** et il vous a laissé ' + u'le message suivant :\n\n> {5}\n\nToute l\'équipe de ' + u'la modération vous remercie !'.format( + alert.author.username, + reaction.author.username, + reaction.article.title, + settings.SITE_URL + + reaction.get_absolute_url(), + request.user.username, + request.POST['text'])) + send_mp( + bot, + [alert.author], + u"Résolution d'alerte : {0}".format(reaction.article.title), + "", + msg, + False + ) + + alert.delete() messages.success( request, u'L\'alerte a bien été résolue') diff --git a/zds/forum/views.py b/zds/forum/views.py index 17e2baf599..51252f9a89 100644 --- a/zds/forum/views.py +++ b/zds/forum/views.py @@ -304,29 +304,33 @@ def solve_alert(request): if not request.user.has_perm("forum.change_post"): raise PermissionDenied + alert = get_object_or_404(Alert, pk=request.POST["alert_pk"]) post = Post.objects.get(pk=alert.comment.id) - bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) - msg = \ - (u'Bonjour {0},' - u'Vous recevez ce message car vous avez signalé le message de *{1}*, ' - u'dans le sujet [{2}]({3}). Votre alerte a été traitée par **{4}** ' - u'et il vous a laissé le message suivant :' - u'\n\n> {5}\n\nToute l\'équipe de la modération vous remercie !'.format( - alert.author.username, - post.author.username, - post.topic.title, - settings.SITE_URL + post.get_absolute_url(), - request.user.username, - request.POST["text"],)) - send_mp( - bot, - [alert.author], - u"Résolution d'alerte : {0}".format(post.topic.title), - "", - msg, - False, - ) + + if request.POST["text"] != "": + bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) + msg = \ + (u'Bonjour {0},' + u'Vous recevez ce message car vous avez signalé le message de *{1}*, ' + u'dans le sujet [{2}]({3}). Votre alerte a été traitée par **{4}** ' + u'et il vous a laissé le message suivant :' + u'\n\n> {5}\n\nToute l\'équipe de la modération vous remercie !'.format( + alert.author.username, + post.author.username, + post.topic.title, + settings.SITE_URL + post.get_absolute_url(), + request.user.username, + request.POST["text"],)) + send_mp( + bot, + [alert.author], + u"Résolution d'alerte : {0}".format(post.topic.title), + "", + msg, + False, + ) + alert.delete() messages.success(request, u"L'alerte a bien été résolue") return redirect(post.get_absolute_url()) diff --git a/zds/tutorial/views.py b/zds/tutorial/views.py index 9941d3b6ee..4ff3f6964e 100644 --- a/zds/tutorial/views.py +++ b/zds/tutorial/views.py @@ -3290,29 +3290,33 @@ def solve_alert(request): if not request.user.has_perm("tutorial.change_note"): raise PermissionDenied + alert = get_object_or_404(Alert, pk=request.POST["alert_pk"]) note = Note.objects.get(pk=alert.comment.id) - bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) - msg = \ - (u'Bonjour {0},' - u'Vous recevez ce message car vous avez signalé le message de *{1}*, ' - u'dans le tutoriel [{2}]({3}). Votre alerte a été traitée par **{4}** ' - u'et il vous a laissé le message suivant :' - u'\n\n> {5}\n\nToute l\'équipe de la modération vous remercie !'.format( - alert.author.username, - note.author.username, - note.tutorial.title, - settings.SITE_URL + note.get_absolute_url(), - request.user.username, - request.POST["text"],)) - send_mp( - bot, - [alert.author], - u"Résolution d'alerte : {0}".format(note.tutorial.title), - "", - msg, - False, - ) + + if request.POST["text"] != "": + bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) + msg = \ + (u'Bonjour {0},' + u'Vous recevez ce message car vous avez signalé le message de *{1}*, ' + u'dans le tutoriel [{2}]({3}). Votre alerte a été traitée par **{4}** ' + u'et il vous a laissé le message suivant :' + u'\n\n> {5}\n\nToute l\'équipe de la modération vous remercie !'.format( + alert.author.username, + note.author.username, + note.tutorial.title, + settings.SITE_URL + note.get_absolute_url(), + request.user.username, + request.POST["text"],)) + send_mp( + bot, + [alert.author], + u"Résolution d'alerte : {0}".format(note.tutorial.title), + "", + msg, + False, + ) + alert.delete() messages.success(request, u"L'alerte a bien été résolue") return redirect(note.get_absolute_url()) From 44044b58082d9016a8aa6feeffb879089a1857dd Mon Sep 17 00:00:00 2001 From: Eskimon Date: Thu, 18 Sep 2014 08:00:54 +0200 Subject: [PATCH 04/71] =?UTF-8?q?Ajout=20des=20corrections=20demand=C3=A9e?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/sphinx/source/install/install-linux.rst | 29 +++++++++------------ 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/doc/sphinx/source/install/install-linux.rst b/doc/sphinx/source/install/install-linux.rst index cbfc8d720d..4fb4ad39db 100644 --- a/doc/sphinx/source/install/install-linux.rst +++ b/doc/sphinx/source/install/install-linux.rst @@ -92,34 +92,29 @@ il peut être utile de rajouter un hook de pre-commit à git. Un hook est un pet programme qui sera exécuté avant une action particulière de git. En l'occurence nous allons rajouter un hook qui s'executera juste avant la validation d'un commit. -Pour cela, commencer par créer eté éditer le fichier .git/hooks/pre-commit +Pour cela, commencer par créer et éditer le fichier `.git/hooks/pre-commit` -.. sourcecode:: bash - -vim .git/hooks/pre-commit - - -Il ne reste plus qu'à rajouter le contenu suivant dans ce fichier et dorénavant +Ensuit, il ne reste plus qu'à rajouter le contenu suivant dans ce fichier et dorénavant le controle flake (pour le respect PEP) sera exécuté avant la validation du message de commit. Ainsi, plus aucune erreur flake ne viendra vous embêter à posteriori et la base de code restera propre et lisible au cours du temps ! .. sourcecode:: bash -#!/bin/sh - -flake8 --exclude=migrations,urls.py,settings.py --max-line-length=120 zds - -# Store tests result -RESULT=$? - -[ $RESULT -ne 0 ] && exit 1 -exit 0 + #!/bin/sh + + flake8 --exclude=migrations,urls.py,settings.py --max-line-length=120 zds + + # Store tests result + RESULT=$? + + [ $RESULT -ne 0 ] && exit 1 + exit 0 Enfin n'oubliez pas de le rendre executable via chmod .. sourcecode:: bash -chmod +x .git/hooks/pre-commit + chmod +x .git/hooks/pre-commit From 1326f30f492d6c5326e799c47570cfc961854374 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Tue, 23 Sep 2014 18:43:56 +0200 Subject: [PATCH 05/71] MaJ des noms de variables dans le SCSS --- assets/scss/_all-supports.scss | 135 ++++++++++++++++---------------- assets/scss/_base.scss | 6 +- assets/scss/_editor.scss | 4 +- assets/scss/_form.scss | 10 +-- assets/scss/_mobile-tablet.scss | 4 +- assets/scss/_tablet.scss | 2 +- assets/scss/_wide.scss | 2 +- assets/scss/main.scss | 27 ++++--- 8 files changed, 96 insertions(+), 94 deletions(-) diff --git a/assets/scss/_all-supports.scss b/assets/scss/_all-supports.scss index 5161cb3eb2..d2a02a8ec8 100644 --- a/assets/scss/_all-supports.scss +++ b/assets/scss/_all-supports.scss @@ -61,13 +61,13 @@ color: #EEE; padding: 4px 13px; margin-left: 15px; - background: $blue; + background: $primary; text-decoration: none; &:hover, &:focus { background: #EEE; - color: $blue; + color: $primary; } } @@ -89,15 +89,15 @@ #accept-cookies { text-decoration: none; background: #EEE; - color: $blue; + color: $primary; padding: 4px 15px; border: none; - transition: background .15s, color .15s; + transition: background $transition-duration, color $transition-duration; margin-top: 3px; &:hover, &:focus { - background: $blue; + background: $primary; color: #EEE; } } @@ -106,14 +106,14 @@ .header-container header { background: #084561; - border-bottom: 3px solid $orange; + border-bottom: 3px solid $secondary; a, button { text-decoration: none; color: #FFF; transition-property: background; - transition-duration: $default-transition-duration; + transition-duration: $transition-duration; &:focus { outline: none; @@ -159,7 +159,7 @@ padding: 10px 2.5%; font-size: 14px; font-size: 1.4rem; - border-bottom: 3px solid $orange; + border-bottom: 3px solid $secondary; z-index: 50; .dropdown-title { @@ -195,7 +195,7 @@ height: 25px; line-height: 25px; color: #95d7f5; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:hover, &:focus { @@ -277,9 +277,9 @@ left: 0; right: 0; height: 2px; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; border-radius: 2px 2px 0 0; - background-color: $orange; + background-color: $secondary; } &.active:before { height: 0; @@ -526,7 +526,7 @@ background: rgba(255, 255, 255, .25); height: 40px; transition-property: background; - transition-duration: $default-transition-duration; + transition-duration: $transition-duration; &:hover, &:focus { @@ -570,7 +570,7 @@ font-size: 24px; background: rgba(255, 255, 255, 1); color: #084561; - transition: background $default-transition-duration ease; + transition: background $transition-duration ease; &:hover, &:focus { @@ -661,8 +661,8 @@ font-size: 16px; font-size: 1.6rem; position: relative; - color: lighten($blue, 20%); - transition: all $default-transition-duration ease; + color: lighten($primary, 20%); + transition: all $transition-duration ease; &:first-child { margin-top: 31px; @@ -690,8 +690,8 @@ font-size: 1.8rem; line-height: 38px; line-height: 3.8rem; - color: $blue; - border-bottom: 1px solid $orange; + color: $primary; + border-bottom: 1px solid $secondary; margin-top: 30px; } h4 { @@ -736,7 +736,7 @@ li { position: relative; padding: 0 0 0 2.5%; - transition: background $default-transition-duration ease; + transition: background $transition-duration ease; &:not(.inactive):hover, a:focus, @@ -875,7 +875,7 @@ border: 1px solid #F0F0F0; box-shadow: rgba(0, 0, 0, .1) 2px 2px 2px; opacity: 0; - transition: visibility 0s linear 0.15s, opacity 0.15s, left 0.15s; + transition: visibility 0s linear $transition-duration, opacity $transition-duration, left $transition-duration; .avatar { height: 40px; @@ -907,7 +907,7 @@ visibility: visible; left: 100%; opacity: 1; - transition: visibility 0s linear 0, opacity 0.15s, left 0.15s; + transition: visibility 0s linear 0, opacity $transition-duration, left $transition-duration; } } } @@ -924,7 +924,7 @@ a { position: relative; color: #084561; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:hover, &:focus { @@ -988,9 +988,9 @@ font-size: 2.2rem; line-height: 38px; line-height: 3.8rem; - color: $blue; + color: $primary; font-weight: normal; - border-bottom: 1px solid $orange; + border-bottom: 1px solid $secondary; margin: 1px 0 15px; &.illu { @@ -1195,7 +1195,7 @@ input, button { - border: 1px solid $orange; + border: 1px solid $secondary; background: #FFF; margin: 5px 0 12px; } @@ -1211,7 +1211,7 @@ text-indent: -9999px; border-left: none; width: 40px; - transition: background .15s; + transition: background $transition-duration; position: absolute; bottom: 0; @@ -1338,7 +1338,7 @@ background: #EEE; color: #777; margin-left: 1px; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:before { content: "#"; @@ -1347,8 +1347,8 @@ &:hover, &:focus { background: #FFF; - color: lighten($blue, 15%); - border-bottom: 1px solid lighten($blue, 15%); + color: lighten($primary, 15%); + border-bottom: 1px solid lighten($primary, 15%); } } } @@ -1400,11 +1400,11 @@ a { display: block; text-decoration: none; - color: lighten($blue, 20%); + color: lighten($primary, 20%); height: 36px; line-height: 36px; padding: 0 8px; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &.ico-after { padding-left: 30px; @@ -1454,7 +1454,7 @@ min-width: 45px; height: 40px; line-height: 40px; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &.current { height: 38px; @@ -1570,7 +1570,7 @@ width: 2px; } &.unread:before { - background: lighten($blue, 20%); + background: lighten($primary, 20%); } &:nth-child(2n){ @@ -1588,21 +1588,21 @@ &.active { &:before { width: 5px; - background: lighten($blue, 20%); + background: lighten($primary, 20%); } } &.selected { - background-color: lighten($blue, 75%); + background-color: lighten($primary, 75%); } } a { text-decoration: none; - color: lighten($blue, 15%); + color: lighten($primary, 15%); &:hover, &:focus { - color: lighten($blue, 15%); + color: lighten($primary, 15%); text-decoration: underline; outline: none; } @@ -1692,7 +1692,7 @@ .topic-no-last-answer { display: block; margin-top: 24px; - color: $blue; + color: $primary; opacity: .5; } } @@ -1709,7 +1709,7 @@ margin-top: 30px !important; clear: both; border-bottom: 1px solid #CCC; - color: $orange; + color: $secondary; } } @@ -2024,7 +2024,6 @@ // touche kbd { - $kbd-color: #F8F6EA; background-color: $kbd-color; padding: 2px 6px; border-radius: 3px; @@ -2059,8 +2058,8 @@ .comments-title { margin: 50px 0 20px; - color: $blue; - border-bottom: 1px solid $orange; + color: $primary; + border-bottom: 1px solid $secondary; font-weight: normal; font-size: 22px; font-size: 2.2rem; @@ -2108,7 +2107,7 @@ table { thead { background: #DDD; - color: $blue; + color: $primary; } th, td { text-align: left; @@ -2222,7 +2221,7 @@ table { line-height: 26px; width: 28px; color: #777; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:first-child { border-right: 0; @@ -2298,12 +2297,12 @@ table { line-height: 30px; padding: 0 5px; border-bottom: 1px solid #D2D5D6; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:hover, &:focus { - border-bottom: 1px solid lighten($blue, 15%); - color: lighten($blue, 15%); + border-bottom: 1px solid lighten($primary, 15%); + color: lighten($primary, 15%); outline: none; } } @@ -2408,7 +2407,7 @@ table { a { color: #999; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:hover, &:focus { @@ -2453,7 +2452,7 @@ table { &:hover, &:focus { color: #555; - border-bottom-color: $upvote-green; + border-bottom-color: $upvote; } &.active { color: #48a200; @@ -2470,12 +2469,12 @@ table { } } .upvote { - color: $upvote-green; + color: $upvote; &:hover, &:focus, &.more-voted { - border-bottom-color: $upvote-green; + border-bottom-color: $upvote; } &:not(.has-vote){ text-indent: -9999px; @@ -2483,12 +2482,12 @@ table { } } .downvote { - color: $downvote-red; + color: $downvote; &:hover, &:focus, &.more-voted { - border-bottom-color: $downvote-red; + border-bottom-color: $downvote; } } .voted:after { @@ -2544,7 +2543,7 @@ table { display: block; float: left; margin-left: 3px; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &.ico-after { padding-left: 30px !important; @@ -2553,7 +2552,7 @@ table { &:after { top: 7px; left: 7px; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; opacity: .5; margin: 0; } @@ -2575,7 +2574,7 @@ table { &:hover, &:focus { - border-bottom-color: lighten($blue, 15%); + border-bottom-color: lighten($primary, 15%); outline: none; background: none; @@ -2612,7 +2611,7 @@ form.topic-message { background: #777; &.staff { - background: $upvote-green; + background: $upvote; } } @@ -2674,7 +2673,7 @@ form.topic-message { list-style: none; &.active, &:hover { - background-color: lighten($blue, 10%); + background-color: lighten($primary, 10%); color: white; } } @@ -2703,14 +2702,14 @@ form.topic-message { &:hover, &.active { - border-color: lighten($blue, 20%) !important; + border-color: lighten($primary, 20%) !important; &:before { display: none; } .topic-title { - background: lighten($blue, 20%) !important; + background: lighten($primary, 20%) !important; color: #FFF; text-decoration: none; } @@ -2760,10 +2759,10 @@ form.topic-message { } &.selected { - border-color: lighten($blue, 75%); + border-color: lighten($primary, 75%); .topic-title { - background: lighten($blue, 75%); + background: lighten($primary, 75%); } } @@ -2778,7 +2777,7 @@ form.topic-message { &:hover, &:focus { background-color: #CCC; - color: lighten($blue, 20%); + color: lighten($primary, 20%); } } } @@ -2866,10 +2865,10 @@ form.topic-message { padding: 20px 0; } .page-footer { - background: darken($blue, 10%); + background: darken($primary, 10%); height: 50px; line-height: 50px; - border-top: 3px solid $orange; + border-top: 3px solid $secondary; font-size: 14px; font-size: 1.4rem; @@ -2898,7 +2897,7 @@ form.topic-message { &:hover, &:focus { - border-bottom-color: $orange; + border-bottom-color: $secondary; } } @@ -2936,12 +2935,12 @@ form.topic-message { .modal-title { display: block; - border-bottom: 3px solid $orange; + border-bottom: 3px solid $secondary; line-height: 53px; height: 50px; text-indent: 15px; margin-bottom: 20px; - background: $blue; + background: $primary; color: #FFF; font-size: 16px; font-size: 1.6rem; @@ -2991,7 +2990,7 @@ form.topic-message { .btn-submit:not(.modal-inner), [type=submit]:not(.modal-inner) { height: 51px; - color: $blue; + color: $primary; font-weight: bold; } .btn-cancel { diff --git a/assets/scss/_base.scss b/assets/scss/_base.scss index e4ac75fc03..9fba00735b 100644 --- a/assets/scss/_base.scss +++ b/assets/scss/_base.scss @@ -70,11 +70,11 @@ textarea { } a { - color: lighten($blue, 20%); - transition: all $default-transition-duration ease; + color: lighten($primary, 20%); + transition: all $transition-duration ease; &:hover { - color: darken($orange, 15%); + color: darken($secondary, 15%); text-decoration: none; } } diff --git a/assets/scss/_editor.scss b/assets/scss/_editor.scss index ccc3887e03..8be5ce8fdd 100644 --- a/assets/scss/_editor.scss +++ b/assets/scss/_editor.scss @@ -65,7 +65,7 @@ button { &:hover, &:focus { - border-bottom-color: lighten($blue, 20%); + border-bottom-color: lighten($primary, 20%); outline: none; background-color: #EEE; } @@ -274,7 +274,7 @@ div.zform-popup { } .btn-submit, [type=submit] { - color: $blue; + color: $primary; font-weight: bold; } .btn-cancel { diff --git a/assets/scss/_form.scss b/assets/scss/_form.scss index d8f1a9605a..9106cfabca 100644 --- a/assets/scss/_form.scss +++ b/assets/scss/_form.scss @@ -81,7 +81,7 @@ button, .btn { -webkit-appearance: none; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; } input:not([type=submit]):not([type=reset]):not([type=radio]):not([type=checkbox]) { @@ -125,19 +125,19 @@ [type=submit], .btn-submit { color: #FFF; - background: $upvote-green; + background: $upvote; &:not([disabled]):hover, &:not([disabled]):focus { - background: lighten($upvote-green, 5%); + background: lighten($upvote, 5%); } } .btn-cancel { - background: $downvote-red; + background: $downvote; &:not([disabled]):hover, &:not([disabled]):focus { - background: lighten($downvote-red, 7%); + background: lighten($downvote, 7%); } } .btn-grey { diff --git a/assets/scss/_mobile-tablet.scss b/assets/scss/_mobile-tablet.scss index 0481e2b5ba..5ca8239ad2 100644 --- a/assets/scss/_mobile-tablet.scss +++ b/assets/scss/_mobile-tablet.scss @@ -14,7 +14,7 @@ .page-container, .mobile-menu { transition-property: transform; - transition-duration: .3s; + transition-duration: $transition-duration * 2; transition-timing-function: ease; } } @@ -643,7 +643,7 @@ height: auto; p { - border-bottom: 1px solid darken($orange, 40%); + border-bottom: 1px solid darken($secondary, 40%); } p, ul { diff --git a/assets/scss/_tablet.scss b/assets/scss/_tablet.scss index 0a7e98ebf8..2553641597 100644 --- a/assets/scss/_tablet.scss +++ b/assets/scss/_tablet.scss @@ -32,7 +32,7 @@ &::-webkit-scrollbar-thumb { background-color: #396a81; border: 1px solid #06354a; - transition: all $default-transition-duration ease; + transition: all $transition-duration ease; &:hover { background-color: #5196b6; diff --git a/assets/scss/_wide.scss b/assets/scss/_wide.scss index 677ba91b47..7cc7461e9d 100644 --- a/assets/scss/_wide.scss +++ b/assets/scss/_wide.scss @@ -526,7 +526,7 @@ &:hover, &:focus { color: #EEE !important; - background: $blue !important; + background: $primary !important; } } } diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 14c7ada2e7..5544ef5091 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -11,9 +11,9 @@ /** * Global vars */ -$default-transition-duration: .15s; +$transition-duration: .15s; -//$sprite: sprite-map("../images/sprite.png"); +//$sprite: url("../images/sprite.png"); $sprite2x: url("../images/sprite@2x.png"); $sprite: $sprite2x; @@ -22,20 +22,23 @@ $sprite: $sprite2x; /** * Colors */ -$body-background: #F7F7F7; -$blue: #084561; -$orange: #F8AD32; -$header-hover: #396a81; -$helpful: #e9f9dc; +$primary: #084561; // Blue for ZdS +$secondary: #F8AD32; // Orange for ZdS -$sidebar-background: #F0F0F0; -$sidebar-hover: #FFF; +$body-background: #F7F7F7; // Background of page body +$header-hover: #396a81; // Hover background of links in header +$helpful: #e9f9dc; // Background of helpful messages -$upvote-green: #48a200; -$downvote-red: #c0392b; +$sidebar-background: #F0F0F0; // Background of sidebar +$sidebar-hover: #FFF; // Background of links on hover + +$upvote: #48a200; // Green for ZdS / Upvote text & staff badge & submit button +$downvote: #c0392b; // Red for ZdS / Downvote text & cancel button + +$kbd-color: #F8F6EA; // Base color for keyboard tag // Margins -$modal-margin: 25px; +$modal-margin: 25px; // Default modal margin (biggest size) // Font Famillies $font-sans-serif: "Segoe UI", "Trebuchet MS", Helvetica, "Helvetica Neue", Arial, sans-serif; From 627f176ac5bdc85d0b8988451e2e2ccaa682da98 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Thu, 25 Sep 2014 16:41:18 +0200 Subject: [PATCH 06/71] Design le sommaire accueil tutoriel --- assets/scss/_all-supports.scss | 42 +++++++++++++++++-- assets/scss/_wide.scss | 9 ++++ templates/tutorial/includes/chapter.part.html | 12 +----- templates/tutorial/includes/part.part.html | 8 ++-- templates/tutorial/tutorial/view.html | 3 +- 5 files changed, 56 insertions(+), 18 deletions(-) diff --git a/assets/scss/_all-supports.scss b/assets/scss/_all-supports.scss index d2a02a8ec8..191e7e52b9 100644 --- a/assets/scss/_all-supports.scss +++ b/assets/scss/_all-supports.scss @@ -1780,7 +1780,7 @@ > a, p a, ul:not(.pagination), - ol { + ol:not(.summary-part) { font-family: $font-serif-active; } } @@ -1798,6 +1798,40 @@ } } + .article-content .summary-part { + font-size: 20px; + color: darken($secondary, 11%); + + h3, + h4 { + font-weight: normal; + + a { + text-decoration: none; + + &:hover, + &:focus { + text-decoration: underline; + } + } + } + h3 { + font-size: 20px; + margin: 0 0 5px; + } + + .summary-part { + list-style: none; + padding-left: 0; + margin-bottom: 15px; + + h4 { + font-size: 14px; + margin: 2px 0; + } + } + } + .article-content, .message-content { margin-top: 20px; @@ -1806,9 +1840,11 @@ h2, h3 { + clear: both; + &, a { - color: #ee8709; + color: darken($secondary, 11%); margin-top: 40px; text-decoration: none; } @@ -2070,7 +2106,7 @@ .article-content { p, ul:not(.pagination), - ol { + ol:not(.summary-part) { font-family: $font-serif-active; } figcaption p { diff --git a/assets/scss/_wide.scss b/assets/scss/_wide.scss index 7cc7461e9d..071a24cb70 100644 --- a/assets/scss/_wide.scss +++ b/assets/scss/_wide.scss @@ -278,6 +278,15 @@ margin: 0; } } + + .article-content > .summary-part > li { + float: left; + width: 50%; + + &:nth-child(2n+1) { + clear: both; + } + } } .sidebar { diff --git a/templates/tutorial/includes/chapter.part.html b/templates/tutorial/includes/chapter.part.html index b7dbc07966..8422e4e77c 100644 --- a/templates/tutorial/includes/chapter.part.html +++ b/templates/tutorial/includes/chapter.part.html @@ -16,17 +16,7 @@
- {% if extracts %} - - {% else %} + {% if not extracts %}

Il n'y a aucun extrait.

diff --git a/templates/tutorial/includes/part.part.html b/templates/tutorial/includes/part.part.html index 9452479d6c..abf3411b3d 100644 --- a/templates/tutorial/includes/part.part.html +++ b/templates/tutorial/includes/part.part.html @@ -9,7 +9,7 @@ {{ part.intro|safe }} {% endif %} -
    +
      {% for chapter in chapters %}
    1. @@ -20,10 +20,10 @@

      {% url "view-chapter-url" tutorial.pk tutorial.slug part.pk part.slug chapter.pk chapter.slug %}{% if version %}?version={{ version }}{% endif %} {% endif %} "> - Chapitre {{ chapter.part.position_in_tutorial }}.{{ chapter.position_in_part }} | {{ chapter.title }} + {{ chapter.title }}

      -
        +
          {% for extract in chapter.extracts %}
        1. @@ -44,6 +44,8 @@

          {% endfor %}

        +
        + {% if part.conclu %} {{ part.conclu|safe }} {% endif %} diff --git a/templates/tutorial/tutorial/view.html b/templates/tutorial/tutorial/view.html index ba553099b0..295bf0bd14 100644 --- a/templates/tutorial/tutorial/view.html +++ b/templates/tutorial/tutorial/view.html @@ -3,6 +3,7 @@ {% load repo_reader %} {% load crispy_forms_tags %} {% load thumbnail %} +{% load roman %} {% block title %} @@ -117,7 +118,7 @@

        {% for part in parts %}

        - Partie {{ part.position_in_tutorial }} : {{ part.title }} + {{ part.position_in_tutorial|roman }} - {{ part.title }}

        {% include "tutorial/includes/part.part.html" %} From 51c9b2f7e1badb1e3260c4dc7041ed131ac0ef49 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 30 Sep 2014 09:07:42 +0200 Subject: [PATCH 07/71] typo --- doc/sphinx/source/install/install-linux.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sphinx/source/install/install-linux.rst b/doc/sphinx/source/install/install-linux.rst index 4fb4ad39db..04e7673b9e 100644 --- a/doc/sphinx/source/install/install-linux.rst +++ b/doc/sphinx/source/install/install-linux.rst @@ -94,7 +94,7 @@ allons rajouter un hook qui s'executera juste avant la validation d'un commit. Pour cela, commencer par créer et éditer le fichier `.git/hooks/pre-commit` -Ensuit, il ne reste plus qu'à rajouter le contenu suivant dans ce fichier et dorénavant +Ensuite, il ne reste plus qu'à rajouter le contenu suivant dans ce fichier et dorénavant le controle flake (pour le respect PEP) sera exécuté avant la validation du message de commit. Ainsi, plus aucune erreur flake ne viendra vous embêter à posteriori et la base de code restera propre et lisible au cours du temps ! From ce161fc04d134ec17a424a54b1ae92525b41e57f Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 30 Sep 2014 20:23:32 +0200 Subject: [PATCH 08/71] =?UTF-8?q?RSS,=20R=C3=A9pare=20les=20liens=20des=20?= =?UTF-8?q?articles/tutos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/article/feeds.py | 2 +- zds/tutorial/feeds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zds/article/feeds.py b/zds/article/feeds.py index da64ad749b..a7b4b7e57b 100644 --- a/zds/article/feeds.py +++ b/zds/article/feeds.py @@ -35,7 +35,7 @@ def item_author_name(self, item): return authors def item_link(self, item): - return item.get_absolute_url() + return item.get_absolute_url_online() class LastArticlesFeedATOM(LastArticlesFeedRSS): diff --git a/zds/tutorial/feeds.py b/zds/tutorial/feeds.py index 560953e2d8..fe31bf7938 100644 --- a/zds/tutorial/feeds.py +++ b/zds/tutorial/feeds.py @@ -35,7 +35,7 @@ def item_author_name(self, item): return authors def item_link(self, item): - return item.get_absolute_url() + return item.get_absolute_url_online() class LastTutorialsFeedATOM(LastTutorialsFeedRSS): From 1ea01ac0cd4ae12bfa8f0c1a3a5d2c565220c688 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Mon, 8 Sep 2014 17:14:23 +0200 Subject: [PATCH 09/71] Merge pull request #1 from Alex-D/fix_1450 Redimentionne les textarea --- templates/tutorial/tutorial/view.html | 4 ++-- zds/tutorial/forms.py | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/templates/tutorial/tutorial/view.html b/templates/tutorial/tutorial/view.html index 295bf0bd14..13b02bcd3c 100644 --- a/templates/tutorial/tutorial/view.html +++ b/templates/tutorial/tutorial/view.html @@ -319,7 +319,7 @@

        En attente de validation {% endif %} - {% endif %} diff --git a/templates/article/validation/history.html b/templates/article/validation/history.html index 64b3cc495a..48f8aedc65 100644 --- a/templates/article/validation/history.html +++ b/templates/article/validation/history.html @@ -1,6 +1,7 @@ {% extends "article/base.html" %} {% load date %} {% load captureas %} +{% load emarkdown %} @@ -72,7 +73,7 @@ {% endif %} diff --git a/templates/tutorial/tutorial/view.html b/templates/tutorial/tutorial/view.html index 916d9e3808..cd3bb5e092 100644 --- a/templates/tutorial/tutorial/view.html +++ b/templates/tutorial/tutorial/view.html @@ -64,7 +64,7 @@

        - {{ validation.comment_authors|safe }} + {{ validation.comment_authors|emarkdown }}
        {% endif %} diff --git a/templates/tutorial/validation/history.html b/templates/tutorial/validation/history.html index 108425b8fc..c9a2b341d4 100644 --- a/templates/tutorial/validation/history.html +++ b/templates/tutorial/validation/history.html @@ -1,6 +1,7 @@ {% extends "tutorial/validation/index.html" %} {% load date %} {% load captureas %} +{% load emarkdown %} @@ -52,7 +53,7 @@ {% endif %} diff --git a/zds/article/views.py b/zds/article/views.py index 68946beb8b..0aa1f900c6 100644 --- a/zds/article/views.py +++ b/zds/article/views.py @@ -658,7 +658,7 @@ def modify(request): validation.status = 'PENDING' validation.article = article validation.date_proposition = datetime.now() - validation.comment_authors = emarkdown(request.POST['comment']) + validation.comment_authors = request.POST['comment'] validation.version = request.POST['version'] if old_validator is not None: diff --git a/zds/tutorial/views.py b/zds/tutorial/views.py index 27d286daff..9941d3b6ee 100644 --- a/zds/tutorial/views.py +++ b/zds/tutorial/views.py @@ -476,7 +476,7 @@ def ask_validation(request): validation = Validation() validation.tutorial = tutorial validation.date_proposition = datetime.now() - validation.comment_authors = emarkdown(request.POST["text"]) + validation.comment_authors = request.POST["text"] validation.version = request.POST["version"] if old_validator is not None: validation.validator = old_validator From 1e94783325827638a71ac4f8ff238287abb813d5 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 30 Sep 2014 22:00:26 +0200 Subject: [PATCH 13/71] Corrige l'affichage des messages de rejet --- templates/misc/validation.part.html | 3 ++- zds/article/views.py | 5 +++-- zds/tutorial/views.py | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/misc/validation.part.html b/templates/misc/validation.part.html index 97ce0d1908..c198af5f30 100644 --- a/templates/misc/validation.part.html +++ b/templates/misc/validation.part.html @@ -1,4 +1,5 @@ {% load date %} +{% load emarkdown %} @@ -59,7 +60,7 @@ {% endif %} diff --git a/zds/article/views.py b/zds/article/views.py index 0aa1f900c6..dc9db75838 100644 --- a/zds/article/views.py +++ b/zds/article/views.py @@ -507,6 +507,7 @@ def modify(request): article.pubdate = None article.save() + comment_reject = '\n'.join(['> '+line for line in validation.comment_validator.split('\n')]) # send feedback for author in article.authors.all(): msg = (u'Désolé **{0}**, ton zeste **{1}** ' @@ -514,7 +515,7 @@ def modify(request): u'Mais ne désespère pas, certaines corrections peuvent ' u'sûrement être faites pour l’améliorer et repasser la ' u'validation plus tard. Voici le message que [{2}]({3}), ' - u'ton validateur t\'a laissé\n\n> {4}\n\nN\'hésite pas a ' + u'ton validateur t\'a laissé\n\n{4}\n\nN\'hésite pas a ' u'lui envoyer un petit message pour discuter de la décision ' u'ou demander plus de détail si tout cela te semble ' u'injuste ou manque de clarté.'.format( @@ -522,7 +523,7 @@ def modify(request): article.title, validation.validator.username, validation.validator.profile.get_absolute_url(), - validation.comment_validator)) + comment_reject)) bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) send_mp( bot, diff --git a/zds/tutorial/views.py b/zds/tutorial/views.py index 9941d3b6ee..75ebf8766d 100644 --- a/zds/tutorial/views.py +++ b/zds/tutorial/views.py @@ -300,6 +300,7 @@ def reject_tutorial(request): # send feedback for author in tutorial.authors.all(): + comment_reject = '\n'.join(['> '+line for line in validation.comment_validator.split('\n')]) msg = ( u'Désolé **{0}**, ton zeste **{1}** n\'a malheureusement ' u'pas passé l’étape de validation. Mais ne désespère pas, ' @@ -313,7 +314,7 @@ def reject_tutorial(request): tutorial.title, validation.validator.username, settings.SITE_URL + validation.validator.profile.get_absolute_url(), - validation.comment_validator)) + comment_reject)) bot = get_object_or_404(User, username=settings.BOT_ACCOUNT) send_mp( bot, From 82b642bfce881eec3d64773a64e46c14f0bb2d60 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Tue, 30 Sep 2014 22:44:06 +0200 Subject: [PATCH 14/71] =?UTF-8?q?R=C3=A8gle=20l'acc=C3=A8s=20=C3=A0=20un?= =?UTF-8?q?=20article=20non=20publi=C3=A9=20(404=20aulieu=20de=20500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/article/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zds/article/views.py b/zds/article/views.py index 0aa1f900c6..b47fe7ed39 100644 --- a/zds/article/views.py +++ b/zds/article/views.py @@ -129,6 +129,10 @@ def view_online(request, article_pk, article_slug): """Show the given article if exists and is visible.""" article = get_object_or_404(Article, pk=article_pk) + # article is not online = 404 + if not article.on_line(): + raise Http404 + # Load the article. article_version = article.load_json_for_public() txt = open(os.path.join(article.get_path(), From 15fe5499d0abf45e476c26b282b3727bb10dc1ca Mon Sep 17 00:00:00 2001 From: Alex-D Date: Wed, 1 Oct 2014 22:59:22 +0200 Subject: [PATCH 15/71] Retire le soulignement des sous-titres MP --- templates/mp/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/mp/index.html b/templates/mp/index.html index b0639ba756..30e46bd8ab 100644 --- a/templates/mp/index.html +++ b/templates/mp/index.html @@ -31,7 +31,7 @@ {% with profile=topic.author|profile %}
        - {% spaceless %} + {% spaceless %} {% if topic.never_read %}Non-lu :{% endif %} {{ topic.title }} {{ topic.subtitle }} From 246a245e721b2cd3b9a345b2b6efb82eb33cf3f4 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Wed, 1 Oct 2014 23:23:45 +0200 Subject: [PATCH 16/71] Place les tags devant les titres --- assets/scss/_all-supports.scss | 32 +++++++++++++++++--- templates/forum/includes/topic_row.part.html | 17 +++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/assets/scss/_all-supports.scss b/assets/scss/_all-supports.scss index 191e7e52b9..350928f02a 100644 --- a/assets/scss/_all-supports.scss +++ b/assets/scss/_all-supports.scss @@ -1644,9 +1644,36 @@ margin: 5px 15px 0 0; } + .topic-tags { + list-style: none; + padding: 0; + margin: 0; + display: inline; + + .topic-tag { + float: left; + padding: 0 5px; + margin: 0 3px 0 0; + color: #FFF; + background: $header-hover; + + &:hover, + &:focus { + background: #FFF; + color: $header-hover; + box-shadow: $header-hover 0 0 3px; + text-decoration: none; + } + } + + li:last-child .topic-tag { + margin-right: 5px; + } + } + .topic-title-link { &:hover, - &:after { + &:focus { text-decoration: none; .topic-title { @@ -1677,9 +1704,6 @@ margin: 0; color: #777; } - .topic-tag:before { - content: "#"; - } } .topic-answers { width: 13%; diff --git a/templates/forum/includes/topic_row.part.html b/templates/forum/includes/topic_row.part.html index 25fbc7ab47..cac0a72d7d 100644 --- a/templates/forum/includes/topic_row.part.html +++ b/templates/forum/includes/topic_row.part.html @@ -21,6 +21,17 @@
        {% with profile=topic.author|profile %} {% endwith %} From e2458772a3ab6e052c6a02d62c50b32051b13257 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Wed, 1 Oct 2014 23:24:55 +0200 Subject: [PATCH 17/71] =?UTF-8?q?Elargit=20la=20derni=C3=A8re=20colonne=20?= =?UTF-8?q?des=20sujets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scss/_all-supports.scss | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/assets/scss/_all-supports.scss b/assets/scss/_all-supports.scss index 350928f02a..98c0ea5b7e 100644 --- a/assets/scss/_all-supports.scss +++ b/assets/scss/_all-supports.scss @@ -1340,10 +1340,6 @@ margin-left: 1px; transition: all $transition-duration ease; - &:before { - content: "#"; - } - &:hover, &:focus { background: #FFF; @@ -1706,12 +1702,12 @@ } } .topic-answers { - width: 13%; + width: 12%; text-align: center; padding-top: 29px; } .topic-last-answer { - width: 22%; + width: 23%; .topic-no-last-answer { display: block; From 909f7e5981c8a9e7b4344551f81c9741c9d8cfcd Mon Sep 17 00:00:00 2001 From: Alex-D Date: Wed, 1 Oct 2014 23:29:40 +0200 Subject: [PATCH 18/71] Accorde la liste des tags aux tags des sujets --- assets/scss/_all-supports.scss | 8 ++++---- templates/forum/includes/topic_row.part.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/scss/_all-supports.scss b/assets/scss/_all-supports.scss index 98c0ea5b7e..469004047c 100644 --- a/assets/scss/_all-supports.scss +++ b/assets/scss/_all-supports.scss @@ -1335,16 +1335,16 @@ display: block; text-decoration: none; padding: 0 10px; - background: #EEE; - color: #777; + background: $header-hover; + color: #FFF; margin-left: 1px; transition: all $transition-duration ease; &:hover, &:focus { background: #FFF; - color: lighten($primary, 15%); - border-bottom: 1px solid lighten($primary, 15%); + color: $header-hover; + border-bottom: 1px solid $header-hover; } } } diff --git a/templates/forum/includes/topic_row.part.html b/templates/forum/includes/topic_row.part.html index cac0a72d7d..4f8209f6ee 100644 --- a/templates/forum/includes/topic_row.part.html +++ b/templates/forum/includes/topic_row.part.html @@ -32,7 +32,7 @@ {% endfor %} {% endif %} - + {{ topic.title }} {{ topic.subtitle }} From 6a511dff282931f84a7016a3721d534b5dc68884 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Thu, 2 Oct 2014 00:07:55 +0200 Subject: [PATCH 19/71] =?UTF-8?q?Ajout=20support=20ic=C3=B4nes=20alert-box?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scss/_all-supports.scss | 8 ++++++++ templates/forum/topic/index.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/scss/_all-supports.scss b/assets/scss/_all-supports.scss index 191e7e52b9..c2eaee121d 100644 --- a/assets/scss/_all-supports.scss +++ b/assets/scss/_all-supports.scss @@ -629,6 +629,14 @@ background: #e67e22; } + &.ico-after { + padding-left: 40px; + + &:after { + margin: 12px 0 0 13px; + } + } + a { color: #EEE; } diff --git a/templates/forum/topic/index.html b/templates/forum/topic/index.html index 3b8d81f010..e9a393fcef 100644 --- a/templates/forum/topic/index.html +++ b/templates/forum/topic/index.html @@ -64,7 +64,7 @@
        {% if topic.is_solved %} -
        +
        L'auteur de ce sujet a trouvé une solution à son problème.
        {% endif %} From 4b6d6fd4469fbe457c266ab6a0019677472b51e1 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Thu, 2 Oct 2014 02:18:12 +0200 Subject: [PATCH 20/71] =?UTF-8?q?Retire=20une=20d=C3=A9pendance=20inutilis?= =?UTF-8?q?=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 7461686ffc..c7af7438d6 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "gulp": "^3.7.0", "gulp-autoprefixer": "0.0.9", "gulp-cache": "^0.2.1", - "gulp-clean": "^0.3.0", "gulp-compass": "^1.1.9", "gulp-concat": "^2.2.0", "gulp-filter": "^1.0.0", From 31810bd4424b928c1baa2a9332fe88b8902e5432 Mon Sep 17 00:00:00 2001 From: Alex-D Date: Thu, 2 Oct 2014 02:42:27 +0200 Subject: [PATCH 21/71] =?UTF-8?q?R=C3=A8gle=20les=20soucis=20d'affichage?= =?UTF-8?q?=20de=20la=20licence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/scss/_mobile-tablet.scss | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/assets/scss/_mobile-tablet.scss b/assets/scss/_mobile-tablet.scss index 5ca8239ad2..c9f793dd50 100644 --- a/assets/scss/_mobile-tablet.scss +++ b/assets/scss/_mobile-tablet.scss @@ -603,15 +603,18 @@ .full-content-wrapper { h1, h2, - h3 { + h3, + .subtitle { padding-left: 10px; padding-right: 10px; } + .illu img { + display: none; + } h4, h5, h6, - .subtitle, .authors, p, figure, @@ -627,6 +630,13 @@ margin-right: 0; } } + + .license { + position: absolute; + margin-top: 0; + top: 62px; + right: 15px; + } } } From 7801e800bebe73d429dabd4adf92da7b982a698e Mon Sep 17 00:00:00 2001 From: Eskimon Date: Thu, 2 Oct 2014 16:31:30 +0200 Subject: [PATCH 22/71] Ajoute un message concernant les nouvelles cat. tuto/article --- zds/article/forms.py | 3 ++- zds/tutorial/forms.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/zds/article/forms.py b/zds/article/forms.py index 051ccb5eef..3e467d59be 100644 --- a/zds/article/forms.py +++ b/zds/article/forms.py @@ -48,7 +48,8 @@ class ArticleForm(forms.Form): ) subcategory = forms.ModelMultipleChoiceField( - label="Sous catégories de votre article", + label=u"Sous catégories de votre article. Si aucune catégorie ne convient " + u"n'hésitez pas à en demander une nouvelle lors de la validation !", queryset=SubCategory.objects.all(), required=False ) diff --git a/zds/tutorial/forms.py b/zds/tutorial/forms.py index 5fb4a6321a..e096b01675 100644 --- a/zds/tutorial/forms.py +++ b/zds/tutorial/forms.py @@ -79,7 +79,8 @@ class TutorialForm(FormWithTitle): ) subcategory = forms.ModelMultipleChoiceField( - label="Sous-catégories de votre tuto", + label=u"Sous catégories de votre tutoriel. Si aucune catégorie ne convient, " + u"n'hésitez pas à en demander une nouvelle lors de la validation !", queryset=SubCategory.objects.all(), required=True, widget=forms.SelectMultiple( From 6f678e84ffc6c227e111a4bcee7f04193b97d27b Mon Sep 17 00:00:00 2001 From: Eskimon Date: Thu, 2 Oct 2014 17:25:45 +0200 Subject: [PATCH 23/71] Ajout de controle sur les champs d'imports --- zds/tutorial/forms.py | 23 ++++++++++++++++++++++- zds/tutorial/views.py | 22 ++++++++-------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/zds/tutorial/forms.py b/zds/tutorial/forms.py index 5fb4a6321a..de7094b154 100644 --- a/zds/tutorial/forms.py +++ b/zds/tutorial/forms.py @@ -279,7 +279,7 @@ class ImportForm(forms.Form): file = forms.FileField( label='Sélectionnez le tutoriel à importer', - required=False + required=True ) images = forms.FileField( label='Fichier zip contenant les images du tutoriel', @@ -298,6 +298,27 @@ def __init__(self, *args, **kwargs): ) super(ImportForm, self).__init__(*args, **kwargs) + def clean(self): + cleaned_data = super(ImportForm, self).clean() + + # Check that the password and it's confirmation match + tuto = cleaned_data.get('file') + images = cleaned_data.get('images') + + if tuto is not None: + ext = tuto.name.split(".")[-1] + if ext != "tuto": + del cleaned_data['file'] + msg = u'Le fichier doit être au format .tuto' + self._errors['file'] = self.error_class([msg]) + + if images is not None: + ext = images.name.split(".")[-1] + if ext != "zip": + del cleaned_data['images'] + msg = u'Le fichier doit être au format .zip' + self._errors['images'] = self.error_class([msg]) + class ImportArchiveForm(forms.Form): diff --git a/zds/tutorial/views.py b/zds/tutorial/views.py index 762fb55b6d..04ec14210a 100644 --- a/zds/tutorial/views.py +++ b/zds/tutorial/views.py @@ -2560,18 +2560,13 @@ def import_tuto(request): # for import tuto if "import-tuto" in request.POST: form = ImportForm(request.POST, request.FILES) - form_archive = ImportArchiveForm(user=request.user) - if "file" in request.FILES: - filename = str(request.FILES["file"]) - ext = filename.split(".")[-1] - if ext == "tuto": - import_content(request, request.FILES["file"], - request.FILES["images"], "") - else: - raise Http404 - return redirect(reverse("zds.member.views.tutorials")) + if form.is_valid(): + import_content(request, request.FILES["file"], request.FILES["images"], "") + return redirect(reverse("zds.member.views.tutorials")) + else: + form_archive = ImportArchiveForm(user=request.user) + elif "import-archive" in request.POST: - form = ImportForm() form_archive = ImportArchiveForm(request.user, request.POST, request.FILES) if form_archive.is_valid(): (check, reason) = import_archive(request) @@ -2581,9 +2576,8 @@ def import_tuto(request): messages.success(request, reason) return redirect(reverse("zds.member.views.tutorials")) else: - return render_template("tutorial/tutorial/import.html", - {"form": form, - "form_archive": form_archive}) + form = ImportForm() + else: form = ImportForm() form_archive = ImportArchiveForm(user=request.user) From 50bf9e03be9ee9343bcb5569353bef396a06adf5 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Thu, 2 Oct 2014 19:19:45 +0200 Subject: [PATCH 24/71] Correction d'un commentaire --- zds/tutorial/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zds/tutorial/forms.py b/zds/tutorial/forms.py index de7094b154..fef207cd3c 100644 --- a/zds/tutorial/forms.py +++ b/zds/tutorial/forms.py @@ -301,7 +301,7 @@ def __init__(self, *args, **kwargs): def clean(self): cleaned_data = super(ImportForm, self).clean() - # Check that the password and it's confirmation match + # Check that the files extensions are correct tuto = cleaned_data.get('file') images = cleaned_data.get('images') From d72029442dc59ec4450a0622283e212927ffbfc3 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Thu, 2 Oct 2014 19:23:02 +0200 Subject: [PATCH 25/71] Correction typo (virgule) --- zds/tutorial/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zds/tutorial/forms.py b/zds/tutorial/forms.py index e096b01675..e2184e1bb1 100644 --- a/zds/tutorial/forms.py +++ b/zds/tutorial/forms.py @@ -79,7 +79,7 @@ class TutorialForm(FormWithTitle): ) subcategory = forms.ModelMultipleChoiceField( - label=u"Sous catégories de votre tutoriel. Si aucune catégorie ne convient, " + label=u"Sous catégories de votre tutoriel. Si aucune catégorie ne convient " u"n'hésitez pas à en demander une nouvelle lors de la validation !", queryset=SubCategory.objects.all(), required=True, From a2f6b70e1e500378d9e7783df0dcc4a9ac0fbb7b Mon Sep 17 00:00:00 2001 From: Alexandre Demode Date: Thu, 2 Oct 2014 22:22:09 +0200 Subject: [PATCH 26/71] =?UTF-8?q?Revert=20"RSS,=20R=C3=A9pare=20les=20lien?= =?UTF-8?q?s=20des=20articles/tutos"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zds/article/feeds.py | 2 +- zds/tutorial/feeds.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zds/article/feeds.py b/zds/article/feeds.py index a7b4b7e57b..da64ad749b 100644 --- a/zds/article/feeds.py +++ b/zds/article/feeds.py @@ -35,7 +35,7 @@ def item_author_name(self, item): return authors def item_link(self, item): - return item.get_absolute_url_online() + return item.get_absolute_url() class LastArticlesFeedATOM(LastArticlesFeedRSS): diff --git a/zds/tutorial/feeds.py b/zds/tutorial/feeds.py index fe31bf7938..560953e2d8 100644 --- a/zds/tutorial/feeds.py +++ b/zds/tutorial/feeds.py @@ -35,7 +35,7 @@ def item_author_name(self, item): return authors def item_link(self, item): - return item.get_absolute_url_online() + return item.get_absolute_url() class LastTutorialsFeedATOM(LastTutorialsFeedRSS): From 77dc7fd269a747e25b7423f27891878c62ccf1d4 Mon Sep 17 00:00:00 2001 From: Eskimon Date: Sat, 4 Oct 2014 00:31:44 +0200 Subject: [PATCH 27/71] Mini custom de l'erreur 500 --- templates/500.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/templates/500.html b/templates/500.html index e0a6a3c115..9e29e66fda 100644 --- a/templates/500.html +++ b/templates/500.html @@ -30,6 +30,12 @@

        Si vous voyez cette page, c'est que vous avez trouvé un bug. Merci de rapporter cette erreur en expliquant comment vous avez procédé - pour tomber sur cette page. + pour tomber sur cette page en créant un sujet sur + + le forum "Bugs et Suggestions". Merci de votre aide ! +

        +

        + Si vous êtes curieux, voici une liste des sujets ouverts à ce propos + sur le bug tracker public de l'association.

        {% endblock %} \ No newline at end of file From 0ecdbe24ebf3dc05b7865fbfa77659a548005ab6 Mon Sep 17 00:00:00 2001 From: firm1 Date: Tue, 23 Sep 2014 08:53:48 +0200 Subject: [PATCH 28/71] =?UTF-8?q?Externalisation=20des=20constantes=20li?= =?UTF-8?q?=C3=A9es=20au=20site?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit documentation et nouveau paramètres correction de tests et pep8 correction d'un test dans le template Typo Typo Typo variabilisation des comptes annonymes et externes rajout de l'indentation indentation contact --- doc/sphinx/source/introduction.rst | 61 ++++++++ doc/sphinx/source/member/member.rst | 16 +-- fixtures/users.yaml | 4 +- templates/base.html | 25 ++-- templates/email/assoc/subscribe.html | 2 +- templates/email/assoc/subscribe.txt | 2 +- templates/email/forgot_password/confirm.html | 4 +- templates/email/forgot_password/confirm.txt | 4 +- templates/email/mp/new.html | 4 +- templates/email/mp/new.txt | 4 +- templates/email/notification/new.html | 4 +- templates/email/notification/new.txt | 4 +- templates/email/register/confirm.html | 4 +- templates/email/register/confirm.txt | 4 +- templates/home.html | 12 +- templates/member/register/index.html | 2 +- templates/pages/about.html | 8 +- templates/pages/assoc_subscribe.html | 10 +- templates/pages/association.html | 12 +- templates/pages/contact.html | 17 +-- templates/pages/cookies.html | 16 +-- templates/pages/eula.html | 37 ++--- templates/pages/index.html | 4 +- templates/tutorial/tutorial/import.html | 2 +- zds/article/feeds.py | 6 +- zds/article/forms.py | 4 +- zds/article/models.py | 6 +- zds/article/tests.py | 6 +- zds/article/views.py | 40 +++--- zds/forum/feeds.py | 12 +- zds/forum/forms.py | 8 +- zds/forum/models.py | 4 +- zds/forum/views.py | 28 ++-- zds/gallery/forms.py | 8 +- zds/gallery/views.py | 7 +- zds/member/tests/tests_models.py | 22 ++- zds/member/tests/tests_views.py | 30 ++-- zds/member/views.py | 76 +++++----- zds/mp/models.py | 2 +- zds/mp/tests/tests_models.py | 2 +- zds/mp/views.py | 31 ++--- zds/pages/tests.py | 8 +- zds/pages/views.py | 12 +- zds/settings.py | 101 ++++++++------ zds/tutorial/feeds.py | 5 +- zds/tutorial/forms.py | 10 +- zds/tutorial/models.py | 27 ++-- zds/tutorial/tests.py | 52 +++---- zds/tutorial/views.py | 138 +++++++++++-------- zds/utils/__init__.py | 3 +- zds/utils/mps.py | 14 +- zds/utils/templatetags/topbar.py | 2 +- zds/utils/tutorials.py | 3 +- 53 files changed, 522 insertions(+), 407 deletions(-) diff --git a/doc/sphinx/source/introduction.rst b/doc/sphinx/source/introduction.rst index 0c635e8d1f..28c3d870df 100644 --- a/doc/sphinx/source/introduction.rst +++ b/doc/sphinx/source/introduction.rst @@ -16,3 +16,64 @@ Si vous voulez installer et démarrer une instance locale de ZdS, vous devez cli install/install-windows install/install-os-x install/install-linux + +Il est possible de personnaliser ZdS pour n'importe quel site communautaire de partage. Un ensemble de paramètres est disponible dans le fichier ``settings.py`` via un dictionnaire. Vous pourrez donc écraser ces variables par défaut dans votre fichier ``settings_prod.py``. Le dictionnaire de variables relatives au site est donc le suivant : + +.. sourcecode:: python + + ZDS_APP = { + 'site': { + 'name': u"ZesteDeSavoir", + 'litteral_name': u"Zeste de Savoir", + 'slogan': u"Zeste de Savoir, la connaissance pour tous et sans pépins", + 'abbr': u"zds", + 'url': u"http://127.0.0.1:8000", + 'dns': u"zestedesavoir.com", + 'email_contact': u"communication@zestedesavoir.com", + 'email_noreply': u"noreply@zestedesavoir.com", + 'repository': u"https://github.com/zestedesavoir/zds-site", + 'short_description': u"", + 'long_description': u"Zeste de Savoir est un site de partage de connaissances " + u"sur lequel vous trouverez des tutoriels de tous niveaux, " + u"des articles et des forums d'entraide animés par et pour " + u"la communauté.", + 'year': u"2014", + 'association': { + 'name': u"Zeste de Savoir", + 'fee': u"30 €", + 'email': u"association@zestedesavoir.com", + 'email_ca': u"ca-zeste-de-savoir@googlegroups.com" + }, + 'hosting': { + 'name': u"OVH", + 'address': u"2 rue Kellermann - 59100 Roubaix - France" + }, + 'cnil': u"1771020", + }, + 'member': { + 'bot_account': u"admin", + 'members_per_page': 100, + }, + 'gallery': { + 'image_max_size': 1024 * 1024, + }, + 'article': { + 'repo_path': os.path.join(SITE_ROOT, 'articles-data'), + }, + 'tutorial': { + 'repo_path': os.path.join(SITE_ROOT, 'tutoriels-private'), + 'repo_public_path': os.path.join(SITE_ROOT, 'tutoriels-public'), + 'default_license_pk': 7 + }, + 'forum': { + 'posts_per_page': 21, + 'topics_per_page': 21, + 'spam_limit_seconds': 60 * 15, + 'spam_limit_participant': 2, + 'followed_topics_per_page': 21, + 'beta_forum_id': 1, + 'max_post_length': 1000000, + 'top_tag_max': 5, + } + } + diff --git a/doc/sphinx/source/member/member.rst b/doc/sphinx/source/member/member.rst index 4a68ff07a7..885b30689f 100644 --- a/doc/sphinx/source/member/member.rst +++ b/doc/sphinx/source/member/member.rst @@ -55,11 +55,11 @@ Le clic sur "me désinscrire" entraîne alors une série d'action (qui sont **ir - pour les sujets du forum (qui, cependant, restent ouverts) - pour les messages des MP (le membre quitte les discussions auxquelles il participait) ; - pour les commentaires aux tutoriels et articles ; - - les `galeries`_ non liées à un tutoriel sont données à ``Auteur externe`` (puisque l’image peut être considérée comme venant d’un “auteur”) avec droit de lecture et d’écriture ; + - les `galeries`_ non liées à un tutoriel sont données à ``external`` (puisque l’image peut être considérée comme venant d’un “auteur”) avec droit de lecture et d’écriture ; - les `articles`_ et `tutoriels`_ suivent ces règles : - si le tutoriel/article a été écrit par plusieurs personnes : le membre est retiré de la liste des auteurs ; - - si le tutoriel/article est *publié*, il passe sur le compte “Auteur externe”. Une demande expresse sera nécessaire au retrait complet de ces contenus ; + - si le tutoriel/article est *publié*, il passe sur le compte “external”. Une demande expresse sera nécessaire au retrait complet de ces contenus ; - si le tutoriel/article n’est pas publié (brouillon, bêta, validation) il est supprimé, ainsi que la galerie qui lui est associée. .. _galeries: ../gallery/gallery.html @@ -76,7 +76,7 @@ Afin de faciliter les procédures de tests en local, 6 utilisateurs ont été cr - staff/staff : Utilisateur avec les droits d'un staff - admin/admin : Utilisateur avec les droits d'un staff et d'un admin - anonymous/anonymous : Utilisateur qui permet l'anonymisation des messages sur les forums, dans les commentaires d'articles et de tutoriels ainsi que dans les MPs -- Auteur externe/external : Utilisateur qui permet de récupérer les tutoriels d'anciens membres et/ou de publier des tutoriels externes. +- external/external : Utilisateur qui permet de récupérer les tutoriels d'anciens membres et/ou de publier des tutoriels externes. - ïtrema/ïtrema : Utilisateur de test supplémentaire sans droit Pour que ces membres soient ajoutés à la base de données, il est donc nécéssaire d'exécuter la commande, suivante, à la racine du site @@ -87,18 +87,18 @@ Pour que ces membres soient ajoutés à la base de données, il est donc nécés .. attention:: - Les utilisateurs ``anonymous`` et ``Auteur externe`` **doivent** être présents dans la base de données pour le bon fonctionnement du site. + Les utilisateurs ``anonymous`` et ``external`` **doivent** être présents dans la base de données pour le bon fonctionnement du site. En effet, ils permettent le bon fonctionnement du processus d'anonymisation (voir `plus haut <#desinscription>`_) -Les utilisateurs ``anonymous`` et ``Auteur externe`` sont totalement paramétrables dans le fichier ``zds/settings.py`` : -pour changer le nom d'utilisateur (*username*) de ces comptes, agissez sur les constantes suivantes : +Les utilisateurs ``anonymous`` et ``external`` sont totalement paramétrables dans le fichier ``zds/settings.py`` : +pour changer le nom d'utilisateur (*username*) de ces comptes, agissez sur les constantes suivantes (du dictionnaire ZDS_APP): .. sourcecode:: python # Constant for anonymisation - ANONYMOUS_USER = "anonymous" - EXTERNAL_USER = "Auteur externe" + anonymous_account = "anonymous" + external_account = "external" Bien entendu, les comptes correspondants doivent exister dans la base de donnée. diff --git a/fixtures/users.yaml b/fixtures/users.yaml index cb659b80c3..445195c2da 100644 --- a/fixtures/users.yaml +++ b/fixtures/users.yaml @@ -63,9 +63,9 @@ - model: auth.user pk: 6 fields: - first_name: Auteur externe + first_name: External last_name: User - username: Auteur externe + username: external password: pbkdf2_sha256$12000$DWHNLpO3jXIv$MrnMZblGu1Q+xemP4XK2keLtbyfkRXxczPTLhSJ0AAM= is_superuser: False - model: member.Profile diff --git a/templates/base.html b/templates/base.html index 158729fb0f..624e180eb9 100644 --- a/templates/base.html +++ b/templates/base.html @@ -25,7 +25,7 @@ {{ title_blocks|safe }} • {% endif %} - Zeste de Savoir + {{app.site.litteral_name}} {% endcaptureas %} {{ title|safe }} @@ -38,8 +38,7 @@ {# Description #} {% captureas description %} {% block description %} - Zeste de Savoir est un site de partage de connaissances sur lequel vous trouverez des tutoriels de tous niveaux, des articles et des forums d'entraide animés par - et pour la communauté. + {{app.site.long_description}} {% endblock %} {% endcaptureas %} @@ -53,9 +52,9 @@ {# OpenGraph #} - + - + @@ -65,13 +64,13 @@ {# Twitter cards #} - + - + - - + + @@ -145,7 +144,7 @@ {% captureas mobiletitle %} {% block mobile_title %} - Zeste de Savoir + {{app.site.litteral_name}} {% endblock %} {% endcaptureas %} @@ -155,7 +154,7 @@ class="header-logo-link" data-title="{{ mobiletitle }}" > - Zeste de Savoir + {{app.site.litteral_name}}
        @@ -528,7 +527,7 @@

        {{ headlin