Commit 147809bb authored by Skia's avatar Skia

Some great weekmail improvements

parent 83555a36
......@@ -6,9 +6,9 @@
{% endblock %}
{% block content %}
<h3>{% trans %}Weekmail{% endtrans %}</h3>
<p><a href="{{ url('com:weekmail_preview') }}" target="_blank">{% trans %}Preview{% endtrans %}</a></p>
<p><a href="?send">{% trans %}Send{% endtrans %}</a></p>
<h3>{% trans %}Weekmail{% endtrans %} {{ object.id }}</h3>
<p><a href="{{ url('com:weekmail_preview') }}">{% trans %}Preview{% endtrans %}</a></p>
<p><a href="{{ url('com:weekmail_preview') }}?send=true">{% trans %}Send{% endtrans %}</a></p>
<h4>{% trans %}Articles in no weekmail yet{% endtrans %}</h4>
<table>
<thead>
......
......@@ -6,6 +6,18 @@
{% endblock %}
{% block content %}
<a href="{{ url('com:weekmail') }}">{% trans %}Back{% endtrans %}</a>
{% if request.GET['send'] %}
<p>{% trans %}Are you sure you want to send this weekmail?{% endtrans %}</p>
{% if request.LANGUAGE_CODE != settings.LANGUAGE_CODE[:2] %}
<p><strong>{% trans %}Warning: you are sending the weekmail in another language than the default one!{% endtrans %}</strong></p>
{% endif %}
<form method="post" action="">
{% csrf_token %}
<button type="submit" name="send" value="validate">{% trans %}Send{% endtrans %}</button>
</form>
{% endif %}
<hr>
{{ weekmail_rendered|safe }}
{% endblock %}
......
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponseRedirect
from django.views.generic import ListView, DetailView, RedirectView
from django.views.generic.edit import UpdateView, CreateView, DeleteView
from django.views.generic.detail import SingleObjectMixin
......@@ -231,10 +232,20 @@ class NewsDetailView(CanViewMixin, DetailView):
# Weekmail
class WeekmailPreviewView(DetailView):
class WeekmailPreviewView(ComTabsMixin, DetailView):
model = Weekmail
template_name = 'com/weekmail_preview.jinja'
success_url = reverse_lazy('com:weekmail')
current_tab = "weekmail"
def post(self, request, *args, **kwargs):
self.object = self.get_object()
try:
if request.POST['send'] == "validate":
self.object.send()
return HttpResponseRedirect(reverse('com:weekmail') + "?qn_weekmail_send_success")
except: pass
return super(WeekmailEditView, self).get(request, *args, **kwargs)
def get_object(self, queryset=None):
return self.model.objects.filter(sent=False).order_by('-id').first()
......@@ -291,9 +302,6 @@ class WeekmailEditView(ComTabsMixin, QuickNotifMixin, UpdateView):
art.rank = -1
art.save()
self.quick_notif_list += ['qn_success']
if 'send' in request.GET.keys():
self.object.send()
self.quick_notif_list += ['qn_success']
return super(WeekmailEditView, self).get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
......
......@@ -102,7 +102,7 @@
<ul id="quick_notif">
{% for n in quick_notifs %}
<li>{{ n }}</li>
<li>{{ n }}</li>
{% endfor %}
</ul>
......
......@@ -17,7 +17,7 @@ from django.utils import timezone
from datetime import timedelta, datetime, date
import logging
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, QuickNotifMixin
from core.views.forms import RegisteringForm, UserPropForm, UserProfileForm, LoginForm, UserGodfathersForm
from core.models import User, SithFile, Preferences
from club.models import Club
......@@ -415,7 +415,7 @@ class UserUpdateGroupView(UserTabsMixin, CanEditPropMixin, UpdateView):
context_object_name = "profile"
current_tab = "groups"
class UserToolsView(UserTabsMixin, TemplateView):
class UserToolsView(QuickNotifMixin, UserTabsMixin, TemplateView):
"""
Displays the logged user's tools
"""
......
......@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-10 23:29+0100\n"
"POT-Creation-Date: 2017-01-11 12:17+0100\n"
"PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n"
......@@ -64,7 +64,8 @@ msgid "account number"
msgstr "numero de compte"
#: accounting/models.py:61 accounting/models.py:86 club/models.py:145
#: com/models.py:34 counter/models.py:104 counter/models.py:131
#: com/models.py:37 com/models.py:119 counter/models.py:104
#: counter/models.py:131
msgid "club"
msgstr "club"
......@@ -124,8 +125,8 @@ msgstr "numéro"
msgid "journal"
msgstr "classeur"
#: accounting/models.py:194 core/models.py:517 core/models.py:862
#: core/models.py:902 counter/models.py:242 counter/models.py:290
#: accounting/models.py:194 core/models.py:528 core/models.py:873
#: core/models.py:913 counter/models.py:242 counter/models.py:290
#: counter/models.py:416 eboutic/models.py:15 eboutic/models.py:48
msgid "date"
msgstr "date"
......@@ -183,11 +184,12 @@ msgstr "Utilisateur"
#: accounting/models.py:207 club/templates/club/club_detail.jinja:5
#: com/templates/com/news_admin_list.jinja:17
#: com/templates/com/news_admin_list.jinja:51
#: com/templates/com/weekmail.jinja:17 com/templates/com/weekmail.jinja:40
#: counter/templates/counter/invoices_call.jinja:20
msgid "Club"
msgstr "Club"
#: accounting/models.py:207 core/views/user.py:179
#: accounting/models.py:207 core/views/user.py:184
msgid "Account"
msgstr "Compte"
......@@ -329,7 +331,7 @@ msgstr "Compte en banque : "
#: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:154 sas/templates/sas/album.jinja:26
#: sas/templates/sas/moderation.jinja:18 sas/templates/sas/picture.jinja:66
#: sas/templates/sas/picture.jinja:116
#: sas/templates/sas/picture.jinja.py:116
msgid "Delete"
msgstr "Supprimer"
......@@ -356,9 +358,9 @@ msgstr "Nouveau compte club"
#: accounting/templates/accounting/journal_details.jinja:82 club/views.py:55
#: com/templates/com/news_admin_list.jinja:39
#: com/templates/com/news_admin_list.jinja:71
#: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31
#: core/templates/core/user_tools.jinja:38 core/views/user.py:152
#: counter/templates/counter/cash_summary_list.jinja:53
#: com/templates/com/weekmail.jinja:54 core/templates/core/file.jinja:38
#: core/templates/core/page.jinja:31 core/templates/core/user_tools.jinja:38
#: core/views/user.py:152 counter/templates/counter/cash_summary_list.jinja:53
#: counter/templates/counter/counter_list.jinja:17
#: counter/templates/counter/counter_list.jinja:32
#: counter/templates/counter/counter_list.jinja:47
......@@ -454,6 +456,7 @@ msgstr "Fermé"
#: accounting/templates/accounting/journal_details.jinja:41
#: com/templates/com/news_admin_list.jinja:22
#: com/templates/com/news_admin_list.jinja:55
#: com/templates/com/weekmail.jinja:20 com/templates/com/weekmail.jinja:43
msgid "Actions"
msgstr "Actions"
......@@ -469,8 +472,8 @@ msgstr "Non"
#: accounting/templates/accounting/club_account_details.jinja:54
#: com/templates/com/news_admin_list.jinja:38
#: com/templates/com/news_admin_list.jinja:70
#: core/templates/core/file.jinja:36 core/templates/core/page.jinja:28
#: com/templates/com/news_admin_list.jinja:70 core/templates/core/file.jinja:36
#: core/templates/core/page.jinja:28
msgid "View"
msgstr "Voir"
......@@ -659,10 +662,10 @@ msgid "Linked operation:"
msgstr "Opération liée : "
#: accounting/templates/accounting/operation_edit.jinja:51
#: com/templates/com/news_edit.jinja:66 core/templates/core/create.jinja:12
#: core/templates/core/edit.jinja:7 core/templates/core/edit.jinja.py:15
#: core/templates/core/edit.jinja:20 core/templates/core/file_edit.jinja:8
#: core/templates/core/page_prop.jinja:8
#: com/templates/com/news_edit.jinja:66 com/templates/com/weekmail.jinja:66
#: core/templates/core/create.jinja:12 core/templates/core/edit.jinja:7
#: core/templates/core/edit.jinja.py:15 core/templates/core/edit.jinja:20
#: core/templates/core/file_edit.jinja:8 core/templates/core/page_prop.jinja:8
#: core/templates/core/pagerev_edit.jinja:24
#: core/templates/core/user_godfathers.jinja:35
#: counter/templates/counter/cash_register_summary.jinja:22
......@@ -826,8 +829,7 @@ msgstr "L'utilisateur est déjà membre de ce club"
msgid "past member"
msgstr "Anciens membres"
#: club/templates/club/club_list.jinja:4
#: club/templates/club/club_list.jinja:24
#: club/templates/club/club_list.jinja:4 club/templates/club/club_list.jinja:24
msgid "Club list"
msgstr "Liste des clubs"
......@@ -889,14 +891,13 @@ msgstr "Du"
msgid "To"
msgstr "Au"
#: club/templates/club/club_sellings.jinja:5 club/views.py:60
#: club/views.py:221 counter/templates/counter/counter_main.jinja:19
#: club/templates/club/club_sellings.jinja:5 club/views.py:60 club/views.py:221
#: counter/templates/counter/counter_main.jinja:19
#: counter/templates/counter/last_ops.jinja:35
msgid "Sellings"
msgstr "Ventes"
#: club/templates/club/club_sellings.jinja:9
#: club/templates/club/stats.jinja:19
#: club/templates/club/club_sellings.jinja:9 club/templates/club/stats.jinja:19
#: counter/templates/counter/cash_summary_list.jinja:15
msgid "Show"
msgstr "Montrer"
......@@ -964,7 +965,7 @@ msgid "Payment method"
msgstr "Méthode de paiement"
#: club/templates/club/club_tools.jinja:4
#: core/templates/core/user_tools.jinja:82
#: core/templates/core/user_tools.jinja:84
msgid "Club tools"
msgstr "Outils club"
......@@ -976,15 +977,19 @@ msgstr "Communication : "
msgid "Create a news"
msgstr "Créer une nouvelle"
#: club/templates/club/club_tools.jinja:10
#: club/templates/club/club_tools.jinja:9
msgid "Post in the Weekmail"
msgstr "Poster dans le Weekmail"
#: club/templates/club/club_tools.jinja:11
msgid "Counters:"
msgstr "Comptoirs : "
#: club/templates/club/club_tools.jinja:26
#: club/templates/club/club_tools.jinja:27
msgid "Accouting: "
msgstr "Comptabilité : "
#: club/templates/club/club_tools.jinja:34
#: club/templates/club/club_tools.jinja:35
msgid "Manage launderettes"
msgstr "Gestion des laveries"
......@@ -1023,8 +1028,7 @@ msgstr "Vous n'avez pas la permission de faire cela"
msgid "Begin date"
msgstr "Date de début"
#: club/views.py:170 com/views.py:81 counter/views.py:933
#: election/views.py:131
#: club/views.py:170 com/views.py:98 counter/views.py:933 election/views.py:131
msgid "End date"
msgstr "Date de fin"
......@@ -1033,84 +1037,115 @@ msgstr "Date de fin"
msgid "Product"
msgstr "Produit"
#: com/models.py:11
#: com/models.py:13
msgid "alert message"
msgstr "message d'alerte"
#: com/models.py:12
#: com/models.py:14
msgid "info message"
msgstr "message d'info"
#: com/models.py:13
#: com/models.py:15
msgid "index page"
msgstr "page d'accueil"
#: com/models.py:22
#: com/models.py:16
msgid "weekmail destinations"
msgstr "destinataires du weekmail"
#: com/models.py:25
msgid "Notice"
msgstr "Information"
#: com/models.py:23
#: com/models.py:26
msgid "Event"
msgstr "Événement"
#: com/models.py:24 com/templates/com/news_list.jinja:79
#: com/models.py:27 com/templates/com/news_list.jinja:79
msgid "Weekly"
msgstr "Hebdomadaire"
#: com/models.py:25
#: com/models.py:28
msgid "Call"
msgstr "Appel"
#: com/models.py:30 election/models.py:14 election/models.py:81
#: election/models.py:118
#: com/models.py:33 com/models.py:75 com/models.py:116 election/models.py:14
#: election/models.py:81 election/models.py:118
msgid "title"
msgstr "titre"
#: com/models.py:31
#: com/models.py:34
msgid "summary"
msgstr "résumé"
#: com/models.py:32
#: com/models.py:35 com/models.py:117
msgid "content"
msgstr "contenu de la nouvelle"
#: com/models.py:33 core/models.py:901 launderette/models.py:60
#: com/models.py:36 core/models.py:912 launderette/models.py:60
#: launderette/models.py:85 launderette/models.py:121
msgid "type"
msgstr "type"
#: com/models.py:35
#: com/models.py:38 com/models.py:118
msgid "author"
msgstr "auteur"
#: com/models.py:36 core/models.py:518
#: com/models.py:39 core/models.py:529
msgid "is moderated"
msgstr "est modéré"
#: com/models.py:37
#: com/models.py:40
msgid "moderator"
msgstr "modérateur"
#: com/models.py:61
#: com/models.py:64
msgid "news_date"
msgstr "date de la nouvelle"
#: com/models.py:62
#: com/models.py:65
msgid "start_date"
msgstr "date de début"
#: com/models.py:63
#: com/models.py:66
msgid "end_date"
msgstr "date de fin"
#: com/models.py:76
msgid "intro"
msgstr "intro"
#: com/models.py:77
msgid "joke"
msgstr "blague"
#: com/models.py:78
msgid "protip"
msgstr "astuce"
#: com/models.py:79
msgid "conclusion"
msgstr "conclusion"
#: com/models.py:80
msgid "sent"
msgstr "envoyé"
#: com/models.py:115
msgid "weekmail"
msgstr "weekmail"
#: com/models.py:120
msgid "rank"
msgstr "rang"
#: com/templates/com/news_admin_list.jinja:5
msgid "News admin"
msgstr "Administration des nouvelles"
#: com/templates/com/news_admin_list.jinja:9
#: com/templates/com/news_detail.jinja:5
#: com/templates/com/news_detail.jinja:11 com/templates/com/news_list.jinja:4
#: com/templates/com/news_list.jinja:28
#: com/templates/com/news_detail.jinja:5 com/templates/com/news_detail.jinja:11
#: com/templates/com/news_list.jinja:4 com/templates/com/news_list.jinja:28
msgid "News"
msgstr "Nouvelles"
......@@ -1127,6 +1162,7 @@ msgstr "Type"
#: com/templates/com/news_admin_list.jinja:15
#: com/templates/com/news_admin_list.jinja:49
#: com/templates/com/weekmail.jinja:18 com/templates/com/weekmail.jinja:41
msgid "Title"
msgstr "Titre"
......@@ -1137,6 +1173,7 @@ msgstr "Résumé"
#: com/templates/com/news_admin_list.jinja:18
#: com/templates/com/news_admin_list.jinja:52
#: com/templates/com/weekmail.jinja:16 com/templates/com/weekmail.jinja:39
msgid "Author"
msgstr "Auteur"
......@@ -1203,7 +1240,7 @@ msgstr ""
"Appel : événement de longue durée, associé à une longue date (candidature, "
"concours, ...)"
#: com/templates/com/news_edit.jinja:65
#: com/templates/com/news_edit.jinja:65 com/templates/com/weekmail.jinja:10
#: core/templates/core/pagerev_edit.jinja:23
msgid "Preview"
msgstr "Prévisualiser"
......@@ -1216,38 +1253,126 @@ msgstr "Événement aujourd'hui et dans les prochains jours"
msgid "Coming soon... don't miss!"
msgstr "Prochainement... à ne pas rater!"
#: com/views.py:27
#: com/templates/com/weekmail.jinja:5 com/templates/com/weekmail.jinja.py:9
#: com/views.py:36 core/templates/core/user_tools.jinja:69
msgid "Weekmail"
msgstr "Weekmail"
#: com/templates/com/weekmail.jinja:11
#: com/templates/com/weekmail_preview.jinja:17
msgid "Send"
msgstr "Envoyer"
#: com/templates/com/weekmail.jinja:12
msgid "Articles in no weekmail yet"
msgstr "Articles dans aucun weekmail"
#: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:42
msgid "Content"
msgstr "Contenu"
#: com/templates/com/weekmail.jinja:30
msgid "Add to weekmail"
msgstr "Ajouter au Weekmail"
#: com/templates/com/weekmail.jinja:35
msgid "Articles included the next weekmail"
msgstr "Article inclus dans le prochain Weekmail"
#: com/templates/com/weekmail.jinja:55
msgid "Delete from weekmail"
msgstr "Supprimer du Weekmail"
#: com/templates/com/weekmail.jinja:56
msgid "Up"
msgstr "Monter"
#: com/templates/com/weekmail.jinja:57
msgid "Down"
msgstr "Descendre"
#: com/templates/com/weekmail_preview.jinja:9
#: core/templates/core/user_account_detail.jinja:11
#: core/templates/core/user_account_detail.jinja:104 launderette/views.py:154
msgid "Back"
msgstr "Retour"
#: com/templates/com/weekmail_preview.jinja:11
msgid "Are you sure you want to send this weekmail?"
msgstr "Êtes-vous sûr de vouloir envoyer ce Weekmail ?"
#: com/templates/com/weekmail_preview.jinja:13
msgid ""
"Warning: you are sending the weekmail in another language than the default "
"one!"
msgstr ""
"Attention : vous allez envoyer le Weekmail dans un langage différent de celui par défaut !"
#: com/templates/com/weekmail_renderer_html.jinja:4
#: com/templates/com/weekmail_renderer_text.jinja:4
msgid "Intro"
msgstr "Intro"
#: com/templates/com/weekmail_renderer_html.jinja:8
#: com/templates/com/weekmail_renderer_text.jinja:8
msgid "Table of content"
msgstr "Sommaire"
#: com/templates/com/weekmail_renderer_html.jinja:21
#: com/templates/com/weekmail_renderer_text.jinja:19
msgid "Joke"
msgstr "Blague"
#: com/templates/com/weekmail_renderer_html.jinja:26
#: com/templates/com/weekmail_renderer_text.jinja:24
msgid "Pro tip"
msgstr "Astuce"
#: com/templates/com/weekmail_renderer_html.jinja:31
#: com/templates/com/weekmail_renderer_text.jinja:29
msgid "Final word"
msgstr "Le mot de la fin"
#: com/views.py:29
msgid "Communication administration"
msgstr "Administration de la communication"
#: com/views.py:34
#: com/views.py:41 core/templates/core/user_tools.jinja:70
msgid "Weekmail destinations"
msgstr "Destinataires du Weekmail"
#: com/views.py:46
msgid "Index page"
msgstr "Page d'accueil"
#: com/views.py:39
#: com/views.py:51
msgid "Info message"
msgstr "Message d'info"
#: com/views.py:44
#: com/views.py:56
msgid "Alert message"
msgstr "Message d'alerte"
#: com/views.py:80 election/views.py:130
#: com/views.py:97 election/views.py:130
msgid "Start date"
msgstr "Date de début"
#: com/views.py:82
#: com/views.py:99
msgid "Until"
msgstr "Jusqu'à"
#: com/views.py:83
#: com/views.py:100
msgid "Automoderation"
msgstr "Automodération"
#: com/views.py:89 com/views.py:91 com/views.py:93
#: com/views.py:106 com/views.py:108 com/views.py:110
msgid "This field is required."
msgstr "Ce champ est obligatoire."
#: com/views.py:270
msgid "Weekmail of the "
msgstr "Weekmail du "
#: core/models.py:29
msgid "meta group status"
msgstr "status du meta-groupe"
......@@ -1488,140 +1613,144 @@ msgid "Visitor"
msgstr "Visiteur"
#: core/models.py:491
msgid "do you want to receive the weekmail"
msgstr "voulez-vous recevoir le Weekmail"
#: core/models.py:496
msgid "define if we show a users stats"
msgstr "Definit si l'on montre les statistiques de l'utilisateur"
#: core/models.py:493
#: core/models.py:498
msgid "Show your account statistics to others"
msgstr "Montrez vos statistiques de compte aux autres"
#: core/models.py:506
#: core/models.py:517
msgid "file name"
msgstr "nom du fichier"
#: core/models.py:507 core/models.py:707
#: core/models.py:518 core/models.py:718
msgid "parent"
msgstr "parent"
#: core/models.py:508 core/models.py:524
#: core/models.py:519 core/models.py:535
msgid "file"
msgstr "fichier"
#: core/models.py:509
#: core/models.py:520
msgid "compressed file"
msgstr "version allégée"
#: core/models.py:510
#: core/models.py:521
msgid "thumbnail"
msgstr "miniature"
#: core/models.py:511 core/models.py:519
#: core/models.py:522 core/models.py:530
msgid "owner"
msgstr "propriétaire"
#: core/models.py:512 core/models.py:713
#: core/models.py:523 core/models.py:724
msgid "edit group"
msgstr "groupe d'édition"
#: core/models.py:513 core/models.py:714
#: core/models.py:524 core/models.py:725
msgid "view group"
msgstr "groupe de vue"
#: core/models.py:514
#: core/models.py:525
msgid "is folder"
msgstr "est un dossier"
#: core/models.py:515
#: core/models.py:526
msgid "mime type"
msgstr "type mime"
#: core/models.py:516
#: core/models.py:527
msgid "size"
msgstr "taille"
#: core/models.py:520
#: core/models.py:531
msgid "asked for removal"
msgstr "retrait demandé"
#: core/models.py:521
#: core/models.py:532
msgid "is in the SAS"
msgstr "est dans le SAS"