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 ""
msgstr ""
"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"
"Last-Translator: Skia <skia@libskia.so>\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
#: trombi/templates/trombi/comment.jinja:4
#: trombi/templates/trombi/comment.jinja:8
#: trombi/templates/trombi/user_tools.jinja:52
#: trombi/templates/trombi/user_tools.jinja:50
msgid "Comment"
msgstr "Commentaire"
@ -1073,7 +1073,7 @@ msgid "Old members"
msgstr "Anciens membres"
#: 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"
msgstr "Outils"
@ -1712,7 +1712,7 @@ msgstr "Un utilisateur de ce nom d'utilisateur existe déjà"
#: election/templates/election/election_detail.jinja:317
#: forum/templates/forum/macros.jinja:93 forum/templates/forum/macros.jinja:95
#: 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"
msgstr "Profil"
@ -2616,7 +2616,7 @@ msgstr "Photos de %(user_name)s"
msgid "Preferences"
msgstr "Préférences"
#: core/templates/core/user_preferences.jinja:14
#: core/templates/core/user_preferences.jinja:14 trombi/views.py:45
msgid "Trombi"
msgstr "Trombi"
@ -4604,8 +4604,8 @@ msgid ""
"Reset club memberships in Trombi (delete exising ones, does not impact real "
"club memberships)"
msgstr ""
"Réinitialiser les participations aux clubs dans le Trombi (supprime les existantes, n'impacte "
"pas les vraies appartenances du site)"
"Réinitialiser les participations aux clubs dans le Trombi (supprime les "
"existantes, n'impacte pas les vraies appartenances du site)"
#: trombi/templates/trombi/edit_profile.jinja:24
msgid "Dates"
@ -4631,19 +4631,11 @@ msgstr "Trombi'"
msgid "You are subscribed to the Trombi %(trombi)s"
msgstr "Vous êtes inscrit au Trombi %(trombi)s"
#: trombi/templates/trombi/user_tools.jinja:17
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
#: trombi/templates/trombi/user_tools.jinja:21
msgid "You can not write comments at this 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
msgid ""
"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 "
"(inclu)"
#: trombi/templates/trombi/user_tools.jinja:50
#: trombi/templates/trombi/user_tools.jinja:48
msgid "Edit comment"
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"
msgstr "Expliquez pourquoi vous refusez le commentaire"
#: trombi/views.py:135
#: trombi/views.py:170
msgid "Rejected comment"
msgstr "Commentaire rejeté"
#: trombi/views.py:136
#: trombi/views.py:171
#, python-format
msgid ""
"Your comment to %(target)s on the Trombi \"%(trombi)s\" was rejected for the "
@ -4680,16 +4684,16 @@ msgstr ""
"\n"
"%(content)s"
#: trombi/views.py:159
#: trombi/views.py:194
#, python-format
msgid "%(name)s (deadline: %(date)s)"
msgstr "%(name)s (date limite: %(date)s)"
#: trombi/views.py:162
#: trombi/views.py:197
msgid "Select trombi"
msgstr "Choisir un trombi"
#: trombi/views.py:163
#: trombi/views.py:198
msgid ""
"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 "
@ -4699,19 +4703,19 @@ msgstr ""
"pouvez vous inscrire qu'à un seul Trombi, donc ne jouez pas avec cet option "
"ou vous encourerez la colère des admins!"
#: trombi/views.py:209
#: trombi/views.py:246
msgid "Personal email (not UTBM)"
msgstr "Email personnel (pas UTBM)"
#: trombi/views.py:210
#: trombi/views.py:247
msgid "Phone"
msgstr "Téléphone"
#: trombi/views.py:211
#: trombi/views.py:248
msgid "Native town"
msgstr "Ville d'origine"
#: trombi/views.py:269
#: trombi/views.py:317
msgid ""
"You can not yet write comment, you must wait for the subscription deadline "
"to be passed."
@ -4719,11 +4723,17 @@ msgstr ""
"Vous ne pouvez pas encore écrire de commentaires, vous devez attendre la fin "
"des inscriptions"
#: trombi/views.py:272
#: trombi/views.py:320
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."
#: trombi/views.py:279
#: trombi/views.py:327
#, python-format
msgid "Maximum characters: %(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>
{% else %}
<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>
{% set can_comment = trombi.subscription_deadline < date.today() and
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 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 Meta:
model = Trombi
@ -70,19 +102,21 @@ class TrombiCreateView(CanEditPropMixin, CreateView):
else:
return self.form_invalid(form)
class TrombiEditView(CanEditPropMixin, UpdateView):
class TrombiEditView(CanEditPropMixin, TrombiTabsMixin, UpdateView):
model = Trombi
form_class = TrombiForm
template_name = 'core/edit.jinja'
pk_url_kwarg = 'trombi_id'
current_tab = "admin_tools"
def get_success_url(self):
return super(TrombiEditView, self).get_success_url()+"?qn_success"
class TrombiDetailView(CanEditMixin, QuickNotifMixin, DetailView):
class TrombiDetailView(CanEditMixin, QuickNotifMixin, TrombiTabsMixin, DetailView):
model = Trombi
template_name = 'trombi/detail.jinja'
pk_url_kwarg = 'trombi_id'
current_tab = "admin_tools"
class TrombiDeleteUserView(CanEditPropMixin, SingleObjectMixin, RedirectView):
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
return redirect(self.object.get_absolute_url()+"?qn_success")
class TrombiModerateCommentsView(CanEditPropMixin, QuickNotifMixin, DetailView):
class TrombiModerateCommentsView(CanEditPropMixin, QuickNotifMixin, TrombiTabsMixin, DetailView):
model = Trombi
template_name = 'trombi/comment_moderation.jinja'
pk_url_kwarg = 'trombi_id'
current_tab = "admin_tools"
def get_context_data(self, **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, "
"or you will expose yourself to the admins' wrath!"))
class UserTrombiToolsView(QuickNotifMixin, TemplateView):
class UserTrombiToolsView(QuickNotifMixin, TrombiTabsMixin, TemplateView):
"""
Display a user's trombi tools
"""
template_name = "trombi/user_tools.jinja"
current_tab = "tools"
def post(self, request, *args, **kwargs):
self.form = UserTrombiForm(request.POST)
@ -189,10 +225,11 @@ class UserTrombiToolsView(QuickNotifMixin, TemplateView):
kwargs['date'] = date
return kwargs
class UserTrombiEditPicturesView(UpdateView):
class UserTrombiEditPicturesView(TrombiTabsMixin, UpdateView):
model = TrombiUser
fields = ['profile_pict', 'scrub_pict']
template_name = "core/edit.jinja"
current_tab = "pictures"
def get_object(self):
return self.request.user.trombi_user
@ -200,7 +237,7 @@ class UserTrombiEditPicturesView(UpdateView):
def get_success_url(self):
return reverse('trombi:user_tools')+"?qn_success"
class UserTrombiEditProfileView(UpdateView):
class UserTrombiEditProfileView(QuickNotifMixin, TrombiTabsMixin, UpdateView):
model = User
form_class = modelform_factory(User,
fields=['second_email', 'phone', 'department', 'dpt_option',
@ -211,6 +248,7 @@ class UserTrombiEditProfileView(UpdateView):
'parent_address': _("Native town"),
})
template_name = "trombi/edit_profile.jinja"
current_tab = "profile"
def get_object(self):
return self.request.user
@ -227,25 +265,35 @@ class UserTrombiResetClubMembershipsView(RedirectView):
return redirect(self.get_success_url())
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
pk_url_kwarg = "membership_id"
template_name = "core/delete_confirm.jinja"
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
pk_url_kwarg = "membership_id"
fields = ['role', 'start', 'end']
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
pk_url_kwarg = "user_id"
template_name = "trombi/user_profile.jinja"
context_object_name = "trombi_user"
current_tab = "tools"
def get(self, request, *args, **kwargs):
self.object = self.get_object()