From 0108743d438583984badae7392174dfc6ff0ad66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Bouttier?= Date: Mon, 5 Sep 2016 17:17:49 +0200 Subject: [PATCH] talk decision: notifications + i18n --- locale/fr/LC_MESSAGES/django.mo | Bin 6433 -> 7461 bytes locale/fr/LC_MESSAGES/django.po | 55 +++++++++++++++--- .../templates/proposals/talk_decide.html | 14 ++--- proposals/views.py | 19 +++++- 4 files changed, 73 insertions(+), 15 deletions(-) diff --git a/locale/fr/LC_MESSAGES/django.mo b/locale/fr/LC_MESSAGES/django.mo index e359dd10df064aae68d9dc94d1f21f7467e215dd..149860e097f6dbe160503576b12d16faa15c4611 100644 GIT binary patch delta 3334 zcma)+d2Ccw6o+pq6v|GKMHYR4fU=ZD))8o{?8qXEfCw_3xzj$F&eVCYMTj~i7!x;$ zRxx4_>dq2^X#~`m7>2|saR~@fG)hR6nh+QG$B;n$elxE?ff#S*yzk!o?m72tZ|Xs6zT6PvskUxjZ_+Wl#rWun5*dUGNOl1>0dqxC`D255ZgDvEcn# z*q-$T*b+*qHE0EA!w$iE87$y_vzp0myr_VR>}e>)El`GDhFxHNux@}l{~45HzrbmVQ`i|EfoUn6U?Rh3pi+AtN+FNM1lStNP$^U@=RkgD z5f5Ed4rOO8R7M_yS%;tk*b4cX*Ln1ZyP@>H>PY@|@FW{Dd>YEbM%Wkr31y%I-t~q> z0gIs=oDG$!1#lF!!TzgIcD4uWw}bU=sCzzu{oqHP$iGtYBO3&5&Oz1cB2;s==cPCZ z>cUbe&!@xba6TLZx55xS3RRi{jL1$O9%|xZDE%@h{TWb!El39&OW>M3V^+a?dGQ5W zGSr@YN})eg35LQRa2({QnFmYZ>VWl7k)MIe%|20(RPC;GJ81OH+ob^9Y0W2gMm3jrd6IzJUHmarX+DR_)bU{d0@Q`FuG+SN zy0|w~3Cf@{FgsW;foUnMVv?;n)Or(?;pYPGfiiFus&?PO(eM(K<0DCn^u|FsJSA99 zgR1#lD0@pGDr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QcBjkGk&(D)CFy z0LSqIe1m#EgXz!4ENcKY!1`&dzm{qj4a+cOzc_F0K_%=%b#NK;@hWNsMv*`BHy3Tq zThv+cFj`rF>ZlSm;A-4}by$wEG}b>zWrzmtNfPU*M7gL#S%OMXg-TF^n$cGKc_((b zjA_R8wBKS>%Htu4?)RaVz8ICajEg2zi<)>{l!|U>Ma}RFWcy46HGmVCjWN`cUP8U5 zw^8?vA!9eMF$-Nhr1l)t$`qpV2CPAB;`4gc0HYVEXb*d_82eEPM$y?*RHAY8;lHSn z=W$RhPRG zCHxsR<4dT4U9%3Mw(22j;D2HfzC?D%co~)Q=b_F}1*YizZ=|w\n" "Language-Team: LANGUAGE \n" @@ -355,6 +355,47 @@ msgstr "exposé" msgid "No speakers." msgstr "Aucun orateur." +#: proposals/templates/proposals/talk_decide.html:9 +msgid "Are you sure to accept this proposals?" +msgstr "Êtes-vous sûr d’accepter cette propositon d’intervention ?" + +#: proposals/templates/proposals/talk_decide.html:9 +msgid "Are you sure to decline this proposals?" +msgstr "Êtes-vous sûr de décliner cette propositon d’intervention ?" + +#: proposals/templates/proposals/talk_decide.html:11 +msgid "Information about the proposals" +msgstr "Information sur la propositon d’intervention" + +#: proposals/templates/proposals/talk_decide.html:12 +msgid "Title:" +msgstr "Titre :" + +#: proposals/templates/proposals/talk_decide.html:13 +msgid "Kind:" +msgstr "Type d’intervention :" + +#: proposals/templates/proposals/talk_decide.html:15 +msgid "Information for the proposer" +msgstr "Information à destination de l’auteur de la proposition" + +#: proposals/templates/proposals/talk_decide.html:19 +msgid "" +"If you want to send a message to the proposer, please enter it below. " +"Remember to indicate which talk your message is reffering." +msgstr "" +"Si vous souhaitez envoyer un message à l’auteur de la proposition, " +"saisissez-le ci-dessous. N’oubliez pas de spécifier à quelle proposition " +"d’intervention votre message fait référence." + +#: proposals/templates/proposals/talk_decide.html:22 +msgid "Accept the proposal" +msgstr "Accepter la proposition" + +#: proposals/templates/proposals/talk_decide.html:22 +msgid "Decline the proposal" +msgstr "Décliner la proposition" + #: proposals/templates/proposals/talk_detail.html:12 #: proposals/templates/proposals/user_details.html:11 msgid "Edit" @@ -446,27 +487,27 @@ msgstr "Ajouter un thème" msgid "reviewer" msgstr "Responsable" -#: proposals/views.py:62 +#: proposals/views.py:65 #, python-format msgid "Talks related to %s:" msgstr "Exposés portant sur la thématique %s :" -#: proposals/views.py:81 +#: proposals/views.py:84 msgid "Talk modified successfully!" msgstr "Exposé modifié avec succès !" -#: proposals/views.py:87 +#: proposals/views.py:90 msgid "Talk proposed successfully!" msgstr "Exposé proposé avec succès !" -#: proposals/views.py:155 +#: proposals/views.py:158 msgid "Vote successfully created" msgstr "A voté !" -#: proposals/views.py:155 +#: proposals/views.py:158 msgid "Vote successfully updated" msgstr "Vote mis à jour" -#: proposals/views.py:167 +#: proposals/views.py:176 msgid "Decision taken in account" msgstr "Décision enregistrée" diff --git a/proposals/templates/proposals/talk_decide.html b/proposals/templates/proposals/talk_decide.html index 852f33f..bb63320 100644 --- a/proposals/templates/proposals/talk_decide.html +++ b/proposals/templates/proposals/talk_decide.html @@ -6,20 +6,20 @@ {% block content %} -

Are you sure to {% if accept %}accept{% else %}decline{% endif %} this proposals?

+

{% if accept %}{% trans "Are you sure to accept this proposals?" %}{% else %}{% trans "Are you sure to decline this proposals?" %}{% endif %}

-

Information about the proposals

-Title: {{ talk.title }}
-Kind: {{ talk.event }}
+

{% trans "Information about the proposals" %}

+{% trans "Title:" %} {{ talk.title }}
+{% trans "Kind:" %} {{ talk.event }}
-

Information for the proposer

+

{% trans "Information for the proposer" %}

{% csrf_token %}
- +
- + {% trans "Cancel" %}
diff --git a/proposals/views.py b/proposals/views.py index 2a5f321..10d46a2 100644 --- a/proposals/views.py +++ b/proposals/views.py @@ -12,9 +12,12 @@ from django.utils.translation import ugettext as _ from django.views.decorators.http import require_http_methods from django.http import HttpResponse +from accounts.models import Participation from accounts.mixins import OrgaRequiredMixin, StaffRequiredMixin from accounts.decorators import orga_required +from conversations.models import ConversationWithParticipant, ConversationAboutTalk, Message + from .forms import TalkForm, TopicCreateForm, TopicUpdateForm, ConferenceForm from .models import Talk, Topic, Vote, Conference from .signals import talk_added, talk_edited @@ -158,10 +161,24 @@ def vote(request, talk, score): @login_required def talk_decide(request, talk, accepted): - talk = get_object_or_404(Talk, site=get_current_site(request), slug=talk) + site = get_current_site(request) + talk = get_object_or_404(Talk, site=site, slug=talk) if not talk.is_moderable_by(request.user): raise PermissionDenied() if request.method == 'POST': + # Does we need to send a notification to the proposer? + m = request.POST.get('message', '').strip() + if m: + participation = Participation.objects.get(site=site, user=talk.proposer) + conversation = ConversationWithParticipant.objects.get(participation=participation) + Message.objects.create(conversation=conversation, author=request.user, content=m) + # Save the decision in the talk's conversation + conversation = ConversationAboutTalk.objects.get(talk=talk) + if accepted: + note = "The talk has been accepted." + else: + note = "The talk has been declined." + Message.objects.create(conversation=conversation, author=request.user, content=note) talk.accepted = accepted talk.save() messages.success(request, _('Decision taken in account'))