mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 22:23:23 +00:00
Some small clean up and refactoring
Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
parent
2925cde8ab
commit
ce46a9d9da
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, UserChangeForm
|
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, UserChangeForm
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.conf import settings
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.contrib.auth import logout, login, authenticate
|
from django.contrib.auth import logout, login, authenticate
|
||||||
@ -75,7 +76,10 @@ class SelectDate(DateInput):
|
|||||||
|
|
||||||
class MarkdownInput(Textarea):
|
class MarkdownInput(Textarea):
|
||||||
def render(self, name, value, attrs=None):
|
def render(self, name, value, attrs=None):
|
||||||
output = '<div class="markdown_editor">%(content)s</div>' % {
|
output = '<p><a href="%(syntax_url)s">%(help_text)s</a></p>'\
|
||||||
|
'<div class="markdown_editor">%(content)s</div>' % {
|
||||||
|
'syntax_url': Page.get_page_by_full_name(settings.SITH_CORE_PAGE_SYNTAX),
|
||||||
|
'help_text': _("Help on the syntax"),
|
||||||
'content': super(MarkdownInput, self).render(name, value, attrs),
|
'content': super(MarkdownInput, self).render(name, value, attrs),
|
||||||
}
|
}
|
||||||
return output
|
return output
|
||||||
|
@ -28,10 +28,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<form action="" method="post" enctype="multipart/form-data">
|
<form action="" method="post" enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<p>{{ form.title.errors }}<label for="{{ form.title.name }}">{{ form.title.label }}</label> {{ form.title }}</p>
|
{{ form.as_p() }}
|
||||||
<p>{{ form.message.errors }}<label for="{{ form.message.name }}">{{ form.message.label }}</label> </p>
|
|
||||||
<p><a href="{{ syntax_help_page.get_absolute_url() }}">{% trans %}Help on the syntax{% endtrans %}</a>
|
|
||||||
{{ form.message }}
|
|
||||||
<p><input type="button" value="{% trans %}Preview{% endtrans %}" onclick="javascript:make_preview();" /></p>
|
<p><input type="button" value="{% trans %}Preview{% endtrans %}" onclick="javascript:make_preview();" /></p>
|
||||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||||
</form>
|
</form>
|
||||||
|
@ -166,11 +166,6 @@ class ForumTopicCreateView(CanCreateMixin, CreateView):
|
|||||||
form.instance.author = self.request.user
|
form.instance.author = self.request.user
|
||||||
return super(ForumTopicCreateView, self).form_valid(form)
|
return super(ForumTopicCreateView, self).form_valid(form)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
kwargs = super(ForumTopicCreateView, self).get_context_data(**kwargs)
|
|
||||||
kwargs['syntax_help_page'] = Page.get_page_by_full_name(settings.SITH_CORE_PAGE_SYNTAX)
|
|
||||||
return kwargs
|
|
||||||
|
|
||||||
class ForumTopicEditView(CanEditMixin, UpdateView):
|
class ForumTopicEditView(CanEditMixin, UpdateView):
|
||||||
model = ForumTopic
|
model = ForumTopic
|
||||||
fields = ['forum']
|
fields = ['forum']
|
||||||
@ -225,7 +220,6 @@ class ForumMessageEditView(CanEditMixin, UpdateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(ForumMessageEditView, self).get_context_data(**kwargs)
|
kwargs = super(ForumMessageEditView, self).get_context_data(**kwargs)
|
||||||
kwargs['topic'] = self.object.topic
|
kwargs['topic'] = self.object.topic
|
||||||
kwargs['syntax_help_page'] = Page.get_page_by_full_name(settings.SITH_CORE_PAGE_SYNTAX)
|
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
class ForumMessageDeleteView(SingleObjectMixin, RedirectView):
|
class ForumMessageDeleteView(SingleObjectMixin, RedirectView):
|
||||||
@ -282,6 +276,5 @@ class ForumMessageCreateView(CanCreateMixin, CreateView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
kwargs = super(ForumMessageCreateView, self).get_context_data(**kwargs)
|
kwargs = super(ForumMessageCreateView, self).get_context_data(**kwargs)
|
||||||
kwargs['topic'] = self.topic
|
kwargs['topic'] = self.topic
|
||||||
kwargs['syntax_help_page'] = Page.get_page_by_full_name(settings.SITH_CORE_PAGE_SYNTAX)
|
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2017-06-10 19:05+0200\n"
|
"POT-Creation-Date: 2017-06-10 19:56+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"
|
||||||
@ -698,7 +698,7 @@ msgstr "Opération liée : "
|
|||||||
#: core/templates/core/user_preferences.jinja:12
|
#: core/templates/core/user_preferences.jinja:12
|
||||||
#: core/templates/core/user_preferences.jinja:19
|
#: core/templates/core/user_preferences.jinja:19
|
||||||
#: counter/templates/counter/cash_register_summary.jinja:22
|
#: counter/templates/counter/cash_register_summary.jinja:22
|
||||||
#: forum/templates/forum/reply.jinja:38
|
#: forum/templates/forum/reply.jinja:33
|
||||||
#: subscription/templates/subscription/subscription.jinja:24
|
#: subscription/templates/subscription/subscription.jinja:24
|
||||||
#: trombi/templates/trombi/comment.jinja:26
|
#: trombi/templates/trombi/comment.jinja:26
|
||||||
#: trombi/templates/trombi/user_tools.jinja:13
|
#: trombi/templates/trombi/user_tools.jinja:13
|
||||||
@ -905,7 +905,7 @@ msgid "Mark as old"
|
|||||||
msgstr "Marquer comme ancien"
|
msgstr "Marquer comme ancien"
|
||||||
|
|
||||||
#: club/templates/club/club_members.jinja:30
|
#: club/templates/club/club_members.jinja:30
|
||||||
#: core/templates/core/file_detail.jinja:19 core/views/forms.py:229
|
#: core/templates/core/file_detail.jinja:19 core/views/forms.py:240
|
||||||
#: launderette/views.py:178
|
#: launderette/views.py:178
|
||||||
msgid "Add"
|
msgid "Add"
|
||||||
msgstr "Ajouter"
|
msgstr "Ajouter"
|
||||||
@ -1060,7 +1060,7 @@ msgstr "Outils"
|
|||||||
msgid "Props"
|
msgid "Props"
|
||||||
msgstr "Propriétés"
|
msgstr "Propriétés"
|
||||||
|
|
||||||
#: club/views.py:131 core/views/forms.py:230 counter/views.py:91
|
#: club/views.py:131 core/views/forms.py:241 counter/views.py:91
|
||||||
msgid "Select user"
|
msgid "Select user"
|
||||||
msgstr "Choisir un utilisateur"
|
msgstr "Choisir un utilisateur"
|
||||||
|
|
||||||
@ -1213,7 +1213,7 @@ msgstr "Type"
|
|||||||
#: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:48
|
#: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:48
|
||||||
#: core/templates/core/base.jinja:243 forum/templates/forum/forum.jinja:27
|
#: core/templates/core/base.jinja:243 forum/templates/forum/forum.jinja:27
|
||||||
#: forum/templates/forum/forum.jinja:46 forum/templates/forum/main.jinja:25
|
#: forum/templates/forum/forum.jinja:46 forum/templates/forum/main.jinja:25
|
||||||
#: forum/views.py:145
|
#: forum/views.py:149
|
||||||
msgid "Title"
|
msgid "Title"
|
||||||
msgstr "Titre"
|
msgstr "Titre"
|
||||||
|
|
||||||
@ -1299,7 +1299,7 @@ msgstr ""
|
|||||||
|
|
||||||
#: com/templates/com/news_edit.jinja:55 com/templates/com/weekmail.jinja:10
|
#: com/templates/com/news_edit.jinja:55 com/templates/com/weekmail.jinja:10
|
||||||
#: core/templates/core/pagerev_edit.jinja:25
|
#: core/templates/core/pagerev_edit.jinja:25
|
||||||
#: forum/templates/forum/reply.jinja:37
|
#: forum/templates/forum/reply.jinja:32
|
||||||
msgid "Preview"
|
msgid "Preview"
|
||||||
msgstr "Prévisualiser"
|
msgstr "Prévisualiser"
|
||||||
|
|
||||||
@ -1582,7 +1582,7 @@ msgstr "-"
|
|||||||
msgid "XS"
|
msgid "XS"
|
||||||
msgstr "XS"
|
msgstr "XS"
|
||||||
|
|
||||||
#: core/models.py:162 core/templates/core/base.jinja:257
|
#: core/models.py:162 core/templates/core/base.jinja:256
|
||||||
msgid "S"
|
msgid "S"
|
||||||
msgstr "S"
|
msgstr "S"
|
||||||
|
|
||||||
@ -1688,7 +1688,7 @@ msgstr "Un utilisateur de ce nom d'utilisateur existe déjà"
|
|||||||
#: core/templates/core/user_edit.jinja:17
|
#: core/templates/core/user_edit.jinja:17
|
||||||
#: 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:43 forum/templates/forum/reply.jinja:45
|
#: 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:43
|
||||||
msgid "Profile"
|
msgid "Profile"
|
||||||
msgstr "Profil"
|
msgstr "Profil"
|
||||||
@ -1968,31 +1968,31 @@ msgstr "https://chemin/vers/image.gif"
|
|||||||
msgid "alternative text"
|
msgid "alternative text"
|
||||||
msgstr "texte alternatif"
|
msgstr "texte alternatif"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:253
|
#: core/templates/core/base.jinja:252
|
||||||
msgid "Image"
|
msgid "Image"
|
||||||
msgstr "Image"
|
msgstr "Image"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:254
|
#: core/templates/core/base.jinja:253
|
||||||
msgid "Link"
|
msgid "Link"
|
||||||
msgstr "Lien"
|
msgstr "Lien"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:255
|
#: core/templates/core/base.jinja:254
|
||||||
msgid "sup"
|
msgid "sup"
|
||||||
msgstr "exp"
|
msgstr "exp"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:256
|
#: core/templates/core/base.jinja:255
|
||||||
msgid "sub"
|
msgid "sub"
|
||||||
msgstr "ind"
|
msgstr "ind"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:258
|
#: core/templates/core/base.jinja:257
|
||||||
msgid "U"
|
msgid "U"
|
||||||
msgstr "S"
|
msgstr "S"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:259
|
#: core/templates/core/base.jinja:258
|
||||||
msgid "I"
|
msgid "I"
|
||||||
msgstr "I"
|
msgstr "I"
|
||||||
|
|
||||||
#: core/templates/core/base.jinja:260
|
#: core/templates/core/base.jinja:259
|
||||||
msgid "B"
|
msgid "B"
|
||||||
msgstr "G"
|
msgstr "G"
|
||||||
|
|
||||||
@ -2785,7 +2785,7 @@ msgstr "Ajouter un nouveau dossier"
|
|||||||
msgid "Error creating folder %(folder_name)s: %(msg)s"
|
msgid "Error creating folder %(folder_name)s: %(msg)s"
|
||||||
msgstr "Erreur de création du dossier %(folder_name)s : %(msg)s"
|
msgstr "Erreur de création du dossier %(folder_name)s : %(msg)s"
|
||||||
|
|
||||||
#: core/views/files.py:97 core/views/forms.py:207 core/views/forms.py:211
|
#: core/views/files.py:97 core/views/forms.py:218 core/views/forms.py:222
|
||||||
#: sas/views.py:77
|
#: sas/views.py:77
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Error uploading file %(file_name)s: %(msg)s"
|
msgid "Error uploading file %(file_name)s: %(msg)s"
|
||||||
@ -2795,19 +2795,23 @@ msgstr "Erreur d'envoi du fichier %(file_name)s : %(msg)s"
|
|||||||
msgid "Apply rights recursively"
|
msgid "Apply rights recursively"
|
||||||
msgstr "Appliquer les droits récursivement"
|
msgstr "Appliquer les droits récursivement"
|
||||||
|
|
||||||
#: core/views/forms.py:84 core/views/forms.py:87
|
#: core/views/forms.py:82
|
||||||
|
msgid "Help on the syntax"
|
||||||
|
msgstr "Aide sur la syntaxe"
|
||||||
|
|
||||||
|
#: core/views/forms.py:95 core/views/forms.py:98
|
||||||
msgid "Choose file"
|
msgid "Choose file"
|
||||||
msgstr "Choisir un fichier"
|
msgstr "Choisir un fichier"
|
||||||
|
|
||||||
#: core/views/forms.py:98 core/views/forms.py:101
|
#: core/views/forms.py:109 core/views/forms.py:112
|
||||||
msgid "Choose user"
|
msgid "Choose user"
|
||||||
msgstr "Choisir un utilisateur"
|
msgstr "Choisir un utilisateur"
|
||||||
|
|
||||||
#: core/views/forms.py:123
|
#: core/views/forms.py:134
|
||||||
msgid "Username, email, or account number"
|
msgid "Username, email, or account number"
|
||||||
msgstr "Nom d'utilisateur, email, ou numéro de compte AE"
|
msgstr "Nom d'utilisateur, email, ou numéro de compte AE"
|
||||||
|
|
||||||
#: core/views/forms.py:165
|
#: core/views/forms.py:176
|
||||||
msgid ""
|
msgid ""
|
||||||
"Profile: you need to be visible on the picture, in order to be recognized (e."
|
"Profile: you need to be visible on the picture, in order to be recognized (e."
|
||||||
"g. by the barmen)"
|
"g. by the barmen)"
|
||||||
@ -2815,23 +2819,23 @@ msgstr ""
|
|||||||
"Photo de profil: vous devez être visible sur la photo afin d'être reconnu "
|
"Photo de profil: vous devez être visible sur la photo afin d'être reconnu "
|
||||||
"(par exemple par les barmen)"
|
"(par exemple par les barmen)"
|
||||||
|
|
||||||
#: core/views/forms.py:166
|
#: core/views/forms.py:177
|
||||||
msgid "Avatar: used on the forum"
|
msgid "Avatar: used on the forum"
|
||||||
msgstr "Avatar : utilisé sur le forum"
|
msgstr "Avatar : utilisé sur le forum"
|
||||||
|
|
||||||
#: core/views/forms.py:167
|
#: core/views/forms.py:178
|
||||||
msgid "Scrub: let other know how your scrub looks like!"
|
msgid "Scrub: let other know how your scrub looks like!"
|
||||||
msgstr "Blouse : montrez aux autres à quoi ressemble votre blouse !"
|
msgstr "Blouse : montrez aux autres à quoi ressemble votre blouse !"
|
||||||
|
|
||||||
#: core/views/forms.py:212
|
#: core/views/forms.py:223
|
||||||
msgid "Bad image format, only jpeg, png, and gif are accepted"
|
msgid "Bad image format, only jpeg, png, and gif are accepted"
|
||||||
msgstr "Mauvais format d'image, seuls les jpeg, png, et gif sont acceptés"
|
msgstr "Mauvais format d'image, seuls les jpeg, png, et gif sont acceptés"
|
||||||
|
|
||||||
#: core/views/forms.py:229
|
#: core/views/forms.py:240
|
||||||
msgid "Godfather"
|
msgid "Godfather"
|
||||||
msgstr "Parrain"
|
msgstr "Parrain"
|
||||||
|
|
||||||
#: core/views/forms.py:229
|
#: core/views/forms.py:240
|
||||||
msgid "Godchild"
|
msgid "Godchild"
|
||||||
msgstr "Fillot"
|
msgstr "Fillot"
|
||||||
|
|
||||||
@ -3710,7 +3714,7 @@ msgid "New forum"
|
|||||||
msgstr "Nouveau forum"
|
msgstr "Nouveau forum"
|
||||||
|
|
||||||
#: forum/templates/forum/forum.jinja:22 forum/templates/forum/reply.jinja:8
|
#: forum/templates/forum/forum.jinja:22 forum/templates/forum/reply.jinja:8
|
||||||
#: forum/templates/forum/reply.jinja:26
|
#: forum/templates/forum/reply.jinja:27
|
||||||
msgid "New topic"
|
msgid "New topic"
|
||||||
msgstr "Nouveau sujet"
|
msgstr "Nouveau sujet"
|
||||||
|
|
||||||
@ -3761,15 +3765,11 @@ msgstr "Voir les derniers messages non lus"
|
|||||||
msgid "Reply"
|
msgid "Reply"
|
||||||
msgstr "Répondre"
|
msgstr "Répondre"
|
||||||
|
|
||||||
#: forum/templates/forum/reply.jinja:32
|
#: forum/views.py:100
|
||||||
msgid "Help on the syntax"
|
|
||||||
msgstr "Aide sur la syntaxe"
|
|
||||||
|
|
||||||
#: forum/views.py:99
|
|
||||||
msgid "Apply rights and club owner recursively"
|
msgid "Apply rights and club owner recursively"
|
||||||
msgstr "Appliquer les droits et le club propriétaire récursivement"
|
msgstr "Appliquer les droits et le club propriétaire récursivement"
|
||||||
|
|
||||||
#: forum/views.py:259
|
#: forum/views.py:262
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%(author)s said"
|
msgid "%(author)s said"
|
||||||
msgstr "Citation de %(author)s"
|
msgstr "Citation de %(author)s"
|
||||||
|
Loading…
Reference in New Issue
Block a user