talk decision: notifications + i18n

This commit is contained in:
Élie Bouttier 2016-09-05 17:17:49 +02:00
parent 82dea2f66b
commit 0108743d43
4 changed files with 73 additions and 15 deletions

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-03 22:35+0000\n" "POT-Creation-Date: 2016-09-05 15:05+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -355,6 +355,47 @@ msgstr "exposé"
msgid "No speakers." msgid "No speakers."
msgstr "Aucun orateur." msgstr "Aucun orateur."
#: proposals/templates/proposals/talk_decide.html:9
msgid "Are you sure to accept this proposals?"
msgstr "Êtes-vous sûr daccepter cette propositon dintervention ?"
#: 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 dintervention ?"
#: proposals/templates/proposals/talk_decide.html:11
msgid "Information about the proposals"
msgstr "Information sur la propositon dintervention"
#: proposals/templates/proposals/talk_decide.html:12
msgid "Title:"
msgstr "Titre :"
#: proposals/templates/proposals/talk_decide.html:13
msgid "Kind:"
msgstr "Type dintervention :"
#: proposals/templates/proposals/talk_decide.html:15
msgid "Information for the proposer"
msgstr "Information à destination de lauteur 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 à lauteur de la proposition, "
"saisissez-le ci-dessous. Noubliez pas de spécifier à quelle proposition "
"dintervention 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/talk_detail.html:12
#: proposals/templates/proposals/user_details.html:11 #: proposals/templates/proposals/user_details.html:11
msgid "Edit" msgid "Edit"
@ -446,27 +487,27 @@ msgstr "Ajouter un thème"
msgid "reviewer" msgid "reviewer"
msgstr "Responsable" msgstr "Responsable"
#: proposals/views.py:62 #: proposals/views.py:65
#, python-format #, python-format
msgid "Talks related to %s:" msgid "Talks related to %s:"
msgstr "Exposés portant sur la thématique %s :" msgstr "Exposés portant sur la thématique %s :"
#: proposals/views.py:81 #: proposals/views.py:84
msgid "Talk modified successfully!" msgid "Talk modified successfully!"
msgstr "Exposé modifié avec succès !" msgstr "Exposé modifié avec succès !"
#: proposals/views.py:87 #: proposals/views.py:90
msgid "Talk proposed successfully!" msgid "Talk proposed successfully!"
msgstr "Exposé proposé avec succès !" msgstr "Exposé proposé avec succès !"
#: proposals/views.py:155 #: proposals/views.py:158
msgid "Vote successfully created" msgid "Vote successfully created"
msgstr "A voté !" msgstr "A voté !"
#: proposals/views.py:155 #: proposals/views.py:158
msgid "Vote successfully updated" msgid "Vote successfully updated"
msgstr "Vote mis à jour" msgstr "Vote mis à jour"
#: proposals/views.py:167 #: proposals/views.py:176
msgid "Decision taken in account" msgid "Decision taken in account"
msgstr "Décision enregistrée" msgstr "Décision enregistrée"

View File

@ -6,20 +6,20 @@
{% block content %} {% block content %}
<h1>Are you sure to {% if accept %}accept{% else %}decline{% endif %} this proposals?</h1> <h1>{% if accept %}{% trans "Are you sure to accept this proposals?" %}{% else %}{% trans "Are you sure to decline this proposals?" %}{% endif %}</h1>
<h3>Information about the proposals</h3> <h3>{% trans "Information about the proposals" %}</h3>
<b>Title:</b> {{ talk.title }}<br /> <b>{% trans "Title:" %}</b> {{ talk.title }}<br />
<b>Kind:</b> {{ talk.event }}<br /> <b>{% trans "Kind:" %}</b> {{ talk.event }}<br />
<h3>Information for the proposer</h3> <h3>{% trans "Information for the proposer" %}</h3>
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
<div class="form-group"> <div class="form-group">
<label for="message">If you want to send a message to the proposer, please enter it below:</label> <label for="message">{% trans "If you want to send a message to the proposer, please enter it below. Remember to indicate which talk your message is reffering." %}</label>
<textarea name="message" class="form-control" rows="5"></textarea> <textarea name="message" class="form-control" rows="5"></textarea>
</div> </div>
<button type="submit" class="btn btn-{% if accept %}success{% else %}danger{% endif %}">{% if accept %}Accept{% else %}Decline{% endif %} the proposal</button> <button type="submit" class="btn btn-{% if accept %}success{% else %}danger{% endif %}">{% if accept %}{% trans "Accept the proposal" %}{% else %}{% trans "Decline the proposal" %}{% endif %}</button>
<a class="btn btn-default" href="{% url 'show-talk' talk.slug %}">{% trans "Cancel" %}</a> <a class="btn btn-default" href="{% url 'show-talk' talk.slug %}">{% trans "Cancel" %}</a>
</form> </form>

View File

@ -12,9 +12,12 @@ from django.utils.translation import ugettext as _
from django.views.decorators.http import require_http_methods from django.views.decorators.http import require_http_methods
from django.http import HttpResponse from django.http import HttpResponse
from accounts.models import Participation
from accounts.mixins import OrgaRequiredMixin, StaffRequiredMixin from accounts.mixins import OrgaRequiredMixin, StaffRequiredMixin
from accounts.decorators import orga_required from accounts.decorators import orga_required
from conversations.models import ConversationWithParticipant, ConversationAboutTalk, Message
from .forms import TalkForm, TopicCreateForm, TopicUpdateForm, ConferenceForm from .forms import TalkForm, TopicCreateForm, TopicUpdateForm, ConferenceForm
from .models import Talk, Topic, Vote, Conference from .models import Talk, Topic, Vote, Conference
from .signals import talk_added, talk_edited from .signals import talk_added, talk_edited
@ -158,10 +161,24 @@ def vote(request, talk, score):
@login_required @login_required
def talk_decide(request, talk, accepted): 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): if not talk.is_moderable_by(request.user):
raise PermissionDenied() raise PermissionDenied()
if request.method == 'POST': 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.accepted = accepted
talk.save() talk.save()
messages.success(request, _('Decision taken in account')) messages.success(request, _('Decision taken in account'))