trombi: Many UI/UX improvements

Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
Skia 2017-06-13 00:23:56 +02:00
parent f26f2f4229
commit f85ce96225
3 changed files with 98 additions and 42 deletions

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-12 23:48+0200\n" "POT-Creation-Date: 2017-06-13 00:20+0200\n"
"PO-Revision-Date: 2016-07-18\n" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -604,7 +604,7 @@ msgstr "Effectuées"
#: counter/templates/counter/cash_summary_list.jinja:37 counter/views.py:798 #: counter/templates/counter/cash_summary_list.jinja:37 counter/views.py:798
#: trombi/templates/trombi/comment.jinja:4 #: trombi/templates/trombi/comment.jinja:4
#: trombi/templates/trombi/comment.jinja:8 #: trombi/templates/trombi/comment.jinja:8
#: trombi/templates/trombi/user_tools.jinja:52 #: trombi/templates/trombi/user_tools.jinja:50
msgid "Comment" msgid "Comment"
msgstr "Commentaire" msgstr "Commentaire"
@ -1073,7 +1073,7 @@ msgid "Old members"
msgstr "Anciens membres" msgstr "Anciens membres"
#: club/views.py:74 core/templates/core/base.jinja:64 core/views/user.py:171 #: club/views.py:74 core/templates/core/base.jinja:64 core/views/user.py:171
#: sas/templates/sas/picture.jinja:95 #: sas/templates/sas/picture.jinja:95 trombi/views.py:52
msgid "Tools" msgid "Tools"
msgstr "Outils" msgstr "Outils"
@ -1712,7 +1712,7 @@ msgstr "Un utilisateur de ce nom d'utilisateur existe déjà"
#: election/templates/election/election_detail.jinja:317 #: election/templates/election/election_detail.jinja:317
#: forum/templates/forum/macros.jinja:93 forum/templates/forum/macros.jinja:95 #: forum/templates/forum/macros.jinja:93 forum/templates/forum/macros.jinja:95
#: forum/templates/forum/reply.jinja:38 forum/templates/forum/reply.jinja:40 #: forum/templates/forum/reply.jinja:38 forum/templates/forum/reply.jinja:40
#: trombi/templates/trombi/user_tools.jinja:43 #: trombi/templates/trombi/user_tools.jinja:41
msgid "Profile" msgid "Profile"
msgstr "Profil" msgstr "Profil"
@ -2616,7 +2616,7 @@ msgstr "Photos de %(user_name)s"
msgid "Preferences" msgid "Preferences"
msgstr "Préférences" msgstr "Préférences"
#: core/templates/core/user_preferences.jinja:14 #: core/templates/core/user_preferences.jinja:14 trombi/views.py:45
msgid "Trombi" msgid "Trombi"
msgstr "Trombi" msgstr "Trombi"
@ -4604,8 +4604,8 @@ msgid ""
"Reset club memberships in Trombi (delete exising ones, does not impact real " "Reset club memberships in Trombi (delete exising ones, does not impact real "
"club memberships)" "club memberships)"
msgstr "" msgstr ""
"Réinitialiser les participations aux clubs dans le Trombi (supprime les existantes, n'impacte " "Réinitialiser les participations aux clubs dans le Trombi (supprime les "
"pas les vraies appartenances du site)" "existantes, n'impacte pas les vraies appartenances du site)"
#: trombi/templates/trombi/edit_profile.jinja:24 #: trombi/templates/trombi/edit_profile.jinja:24
msgid "Dates" msgid "Dates"
@ -4631,19 +4631,11 @@ msgstr "Trombi'"
msgid "You are subscribed to the Trombi %(trombi)s" msgid "You are subscribed to the Trombi %(trombi)s"
msgstr "Vous êtes inscrit au Trombi %(trombi)s" msgstr "Vous êtes inscrit au Trombi %(trombi)s"
#: trombi/templates/trombi/user_tools.jinja:17 #: trombi/templates/trombi/user_tools.jinja:21
msgid "Edit my profile"
msgstr "Éditer mon profil"
#: trombi/templates/trombi/user_tools.jinja:18
msgid "Edit my pictures"
msgstr "Éditer mes photos"
#: trombi/templates/trombi/user_tools.jinja:23
msgid "You can not write comments at this date." msgid "You can not write comments at this date."
msgstr "Vous ne pouvez pas commenter à cette date." msgstr "Vous ne pouvez pas commenter à cette date."
#: trombi/templates/trombi/user_tools.jinja:25 #: trombi/templates/trombi/user_tools.jinja:23
#, python-format #, python-format
msgid "" msgid ""
"Comments are only allowed between %(start)s (excluded) and %(end)s (included)" "Comments are only allowed between %(start)s (excluded) and %(end)s (included)"
@ -4651,19 +4643,31 @@ msgstr ""
"Les commentaires sont autorisés entre le %(start)s (exclu) et le %(end)s " "Les commentaires sont autorisés entre le %(start)s (exclu) et le %(end)s "
"(inclu)" "(inclu)"
#: trombi/templates/trombi/user_tools.jinja:50 #: trombi/templates/trombi/user_tools.jinja:48
msgid "Edit comment" msgid "Edit comment"
msgstr "Éditer le commentaire" msgstr "Éditer le commentaire"
#: trombi/views.py:111 #: trombi/views.py:57
msgid "My profile"
msgstr "Mon profil"
#: trombi/views.py:62
msgid "My pictures"
msgstr "Mes photos"
#: trombi/views.py:70
msgid "Admin tools"
msgstr "Admin Trombi"
#: trombi/views.py:146
msgid "Explain why you rejected the comment" msgid "Explain why you rejected the comment"
msgstr "Expliquez pourquoi vous refusez le commentaire" msgstr "Expliquez pourquoi vous refusez le commentaire"
#: trombi/views.py:135 #: trombi/views.py:170
msgid "Rejected comment" msgid "Rejected comment"
msgstr "Commentaire rejeté" msgstr "Commentaire rejeté"
#: trombi/views.py:136 #: trombi/views.py:171
#, python-format #, python-format
msgid "" msgid ""
"Your comment to %(target)s on the Trombi \"%(trombi)s\" was rejected for the " "Your comment to %(target)s on the Trombi \"%(trombi)s\" was rejected for the "
@ -4680,16 +4684,16 @@ msgstr ""
"\n" "\n"
"%(content)s" "%(content)s"
#: trombi/views.py:159 #: trombi/views.py:194
#, python-format #, python-format
msgid "%(name)s (deadline: %(date)s)" msgid "%(name)s (deadline: %(date)s)"
msgstr "%(name)s (date limite: %(date)s)" msgstr "%(name)s (date limite: %(date)s)"
#: trombi/views.py:162 #: trombi/views.py:197
msgid "Select trombi" msgid "Select trombi"
msgstr "Choisir un trombi" msgstr "Choisir un trombi"
#: trombi/views.py:163 #: trombi/views.py:198
msgid "" msgid ""
"This allows you to subscribe to a Trombi. Be aware that you can subscribe " "This allows you to subscribe to a Trombi. Be aware that you can subscribe "
"only once, so don't play with that, or you will expose yourself to the " "only once, so don't play with that, or you will expose yourself to the "
@ -4699,19 +4703,19 @@ msgstr ""
"pouvez vous inscrire qu'à un seul Trombi, donc ne jouez pas avec cet option " "pouvez vous inscrire qu'à un seul Trombi, donc ne jouez pas avec cet option "
"ou vous encourerez la colère des admins!" "ou vous encourerez la colère des admins!"
#: trombi/views.py:209 #: trombi/views.py:246
msgid "Personal email (not UTBM)" msgid "Personal email (not UTBM)"
msgstr "Email personnel (pas UTBM)" msgstr "Email personnel (pas UTBM)"
#: trombi/views.py:210 #: trombi/views.py:247
msgid "Phone" msgid "Phone"
msgstr "Téléphone" msgstr "Téléphone"
#: trombi/views.py:211 #: trombi/views.py:248
msgid "Native town" msgid "Native town"
msgstr "Ville d'origine" msgstr "Ville d'origine"
#: trombi/views.py:269 #: trombi/views.py:317
msgid "" msgid ""
"You can not yet write comment, you must wait for the subscription deadline " "You can not yet write comment, you must wait for the subscription deadline "
"to be passed." "to be passed."
@ -4719,11 +4723,17 @@ msgstr ""
"Vous ne pouvez pas encore écrire de commentaires, vous devez attendre la fin " "Vous ne pouvez pas encore écrire de commentaires, vous devez attendre la fin "
"des inscriptions" "des inscriptions"
#: trombi/views.py:272 #: trombi/views.py:320
msgid "You can not write comment anymore, the deadline is already passed." msgid "You can not write comment anymore, the deadline is already passed."
msgstr "Vous ne pouvez plus écrire de commentaires, la date est passée." msgstr "Vous ne pouvez plus écrire de commentaires, la date est passée."
#: trombi/views.py:279 #: trombi/views.py:327
#, python-format #, python-format
msgid "Maximum characters: %(max_length)s" msgid "Maximum characters: %(max_length)s"
msgstr "Nombre de caractères max: %(max_length)s" msgstr "Nombre de caractères max: %(max_length)s"
#~ msgid "Edit my profile"
#~ msgstr "Éditer mon profil"
#~ msgid "Edit my pictures"
#~ msgstr "Éditer mes photos"

View File

@ -14,8 +14,6 @@
</form> </form>
{% else %} {% else %}
<p>{% trans trombi = user.trombi_user.trombi %}You are subscribed to the Trombi {{ trombi }}{% endtrans %}</p> <p>{% trans trombi = user.trombi_user.trombi %}You are subscribed to the Trombi {{ trombi }}{% endtrans %}</p>
<p><a href="{{ url("trombi:profile") }}">{% trans %}Edit my profile{% endtrans %}</a></p>
<p><a href="{{ url("trombi:pictures") }}">{% trans %}Edit my pictures{% endtrans %}</a></p>
<hr> <hr>
{% set can_comment = trombi.subscription_deadline < date.today() and {% set can_comment = trombi.subscription_deadline < date.today() and
date.today() <= trombi.comments_deadline %} date.today() <= trombi.comments_deadline %}

View File

@ -40,6 +40,38 @@ from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMi
from core.models import User from core.models import User
from club.models import Club from club.models import Club
class TrombiTabsMixin(TabedViewMixin):
def get_tabs_title(self):
return _("Trombi")
def get_list_of_tabs(self):
tab_list = []
tab_list.append({
'url': reverse('trombi:user_tools'),
'slug': 'tools',
'name': _("Tools"),
})
tab_list.append({
'url': reverse('trombi:profile'),
'slug': 'profile',
'name': _("My profile"),
})
tab_list.append({
'url': reverse('trombi:pictures'),
'slug': 'pictures',
'name': _("My pictures"),
})
try:
trombi = self.request.user.trombi_user.trombi
if self.request.user.is_owner(trombi):
tab_list.append({
'url': reverse('trombi:detail', kwargs={'trombi_id': trombi.id}),
'slug': 'admin_tools',
'name': _("Admin tools"),
})
except: pass
return tab_list
class TrombiForm(forms.ModelForm): class TrombiForm(forms.ModelForm):
class Meta: class Meta:
model = Trombi model = Trombi
@ -70,19 +102,21 @@ class TrombiCreateView(CanEditPropMixin, CreateView):
else: else:
return self.form_invalid(form) return self.form_invalid(form)
class TrombiEditView(CanEditPropMixin, UpdateView): class TrombiEditView(CanEditPropMixin, TrombiTabsMixin, UpdateView):
model = Trombi model = Trombi
form_class = TrombiForm form_class = TrombiForm
template_name = 'core/edit.jinja' template_name = 'core/edit.jinja'
pk_url_kwarg = 'trombi_id' pk_url_kwarg = 'trombi_id'
current_tab = "admin_tools"
def get_success_url(self): def get_success_url(self):
return super(TrombiEditView, self).get_success_url()+"?qn_success" return super(TrombiEditView, self).get_success_url()+"?qn_success"
class TrombiDetailView(CanEditMixin, QuickNotifMixin, DetailView): class TrombiDetailView(CanEditMixin, QuickNotifMixin, TrombiTabsMixin, DetailView):
model = Trombi model = Trombi
template_name = 'trombi/detail.jinja' template_name = 'trombi/detail.jinja'
pk_url_kwarg = 'trombi_id' pk_url_kwarg = 'trombi_id'
current_tab = "admin_tools"
class TrombiDeleteUserView(CanEditPropMixin, SingleObjectMixin, RedirectView): class TrombiDeleteUserView(CanEditPropMixin, SingleObjectMixin, RedirectView):
model = Trombi model = Trombi
@ -96,10 +130,11 @@ class TrombiDeleteUserView(CanEditPropMixin, SingleObjectMixin, RedirectView):
# See if we need to also delete the comments on the user, or if we keep them # See if we need to also delete the comments on the user, or if we keep them
return redirect(self.object.get_absolute_url()+"?qn_success") return redirect(self.object.get_absolute_url()+"?qn_success")
class TrombiModerateCommentsView(CanEditPropMixin, QuickNotifMixin, DetailView): class TrombiModerateCommentsView(CanEditPropMixin, QuickNotifMixin, TrombiTabsMixin, DetailView):
model = Trombi model = Trombi
template_name = 'trombi/comment_moderation.jinja' template_name = 'trombi/comment_moderation.jinja'
pk_url_kwarg = 'trombi_id' pk_url_kwarg = 'trombi_id'
current_tab = "admin_tools"
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
kwargs = super(TrombiModerateCommentsView, self).get_context_data(**kwargs) kwargs = super(TrombiModerateCommentsView, self).get_context_data(**kwargs)
@ -164,11 +199,12 @@ class UserTrombiForm(forms.Form):
"Be aware that you can subscribe only once, so don't play with that, " "Be aware that you can subscribe only once, so don't play with that, "
"or you will expose yourself to the admins' wrath!")) "or you will expose yourself to the admins' wrath!"))
class UserTrombiToolsView(QuickNotifMixin, TemplateView): class UserTrombiToolsView(QuickNotifMixin, TrombiTabsMixin, TemplateView):
""" """
Display a user's trombi tools Display a user's trombi tools
""" """
template_name = "trombi/user_tools.jinja" template_name = "trombi/user_tools.jinja"
current_tab = "tools"
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.form = UserTrombiForm(request.POST) self.form = UserTrombiForm(request.POST)
@ -189,10 +225,11 @@ class UserTrombiToolsView(QuickNotifMixin, TemplateView):
kwargs['date'] = date kwargs['date'] = date
return kwargs return kwargs
class UserTrombiEditPicturesView(UpdateView): class UserTrombiEditPicturesView(TrombiTabsMixin, UpdateView):
model = TrombiUser model = TrombiUser
fields = ['profile_pict', 'scrub_pict'] fields = ['profile_pict', 'scrub_pict']
template_name = "core/edit.jinja" template_name = "core/edit.jinja"
current_tab = "pictures"
def get_object(self): def get_object(self):
return self.request.user.trombi_user return self.request.user.trombi_user
@ -200,7 +237,7 @@ class UserTrombiEditPicturesView(UpdateView):
def get_success_url(self): def get_success_url(self):
return reverse('trombi:user_tools')+"?qn_success" return reverse('trombi:user_tools')+"?qn_success"
class UserTrombiEditProfileView(UpdateView): class UserTrombiEditProfileView(QuickNotifMixin, TrombiTabsMixin, UpdateView):
model = User model = User
form_class = modelform_factory(User, form_class = modelform_factory(User,
fields=['second_email', 'phone', 'department', 'dpt_option', fields=['second_email', 'phone', 'department', 'dpt_option',
@ -211,6 +248,7 @@ class UserTrombiEditProfileView(UpdateView):
'parent_address': _("Native town"), 'parent_address': _("Native town"),
}) })
template_name = "trombi/edit_profile.jinja" template_name = "trombi/edit_profile.jinja"
current_tab = "profile"
def get_object(self): def get_object(self):
return self.request.user return self.request.user
@ -227,25 +265,35 @@ class UserTrombiResetClubMembershipsView(RedirectView):
return redirect(self.get_success_url()) return redirect(self.get_success_url())
def get_success_url(self): def get_success_url(self):
return reverse('trombi:user_tools')+"?qn_success" return reverse('trombi:profile')+"?qn_success"
class UserTrombiDeleteMembershipView(DeleteView, CanEditMixin): class UserTrombiDeleteMembershipView(TrombiTabsMixin, CanEditMixin, DeleteView):
model = TrombiClubMembership model = TrombiClubMembership
pk_url_kwarg = "membership_id" pk_url_kwarg = "membership_id"
template_name = "core/delete_confirm.jinja" template_name = "core/delete_confirm.jinja"
success_url = reverse_lazy('trombi:profile') success_url = reverse_lazy('trombi:profile')
current_tab = "profile"
class UserTrombiEditMembershipView(UpdateView, CanEditMixin): def get_success_url(self):
return super(UserTrombiDeleteMembershipView, self).get_success_url() + "?qn_success"
class UserTrombiEditMembershipView(CanEditMixin, TrombiTabsMixin, UpdateView):
model = TrombiClubMembership model = TrombiClubMembership
pk_url_kwarg = "membership_id" pk_url_kwarg = "membership_id"
fields = ['role', 'start', 'end'] fields = ['role', 'start', 'end']
template_name = "core/edit.jinja" template_name = "core/edit.jinja"
current_tab = "profile"
class UserTrombiProfileView(DetailView): def get_success_url(self):
return super(UserTrombiEditMembershipView, self).get_success_url() + "?qn_success"
class UserTrombiProfileView(TrombiTabsMixin, DetailView):
model = TrombiUser model = TrombiUser
pk_url_kwarg = "user_id" pk_url_kwarg = "user_id"
template_name = "trombi/user_profile.jinja" template_name = "trombi/user_profile.jinja"
context_object_name = "trombi_user" context_object_name = "trombi_user"
current_tab = "tools"
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.object = self.get_object() self.object = self.get_object()