mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
Some more pimp in Trombi + translations
This commit is contained in:
parent
35f983131f
commit
d913b8b64f
@ -11,6 +11,7 @@
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
<h4>{% trans %}Trombi{% endtrans %}</h4>
|
||||
{% if trombi_form %}
|
||||
<form action="{{ url('trombi:user_tools') }}" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
@ -18,7 +19,8 @@
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
{% else %}
|
||||
<p><a href="{{ url('trombi:user_tools') }}">Trombi tools</a></p>
|
||||
<p>{% trans trombi=user.trombi_user.trombi %}You already choose to be in that Trombi: {{ trombi }}.{% endtrans %}
|
||||
<a href="{{ url('trombi:user_tools') }}">{% trans %}Go to my Trombi tools{% endtrans %}</a></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
@ -106,6 +106,10 @@
|
||||
<li><a href="{{ url('election:create') }}">{% trans %}Create a new election{% endtrans %}</a></li>
|
||||
{%- endif -%}
|
||||
</ul>
|
||||
<h4>{% trans %}Other tools{% endtrans %}</h4>
|
||||
<ul>
|
||||
<li><a href="{{ url('trombi:user_tools') }}">{% trans %}Trombi tools{% endtrans %}</a></li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -55,9 +55,9 @@ class Trombi(models.Model):
|
||||
"After this date, users subscribed will be allowed to comment on each other."))
|
||||
comments_deadline = models.DateField(_('comments deadline'),
|
||||
default=timezone.now, help_text=_("After this date, users won't be "
|
||||
"able to make comments anymore"))
|
||||
"able to make comments anymore."))
|
||||
max_chars = models.IntegerField(_('maximum characters'), default=400,
|
||||
help_text=_('maximum number of characters allowed in a comment'))
|
||||
help_text=_('Maximum number of characters allowed in a comment.'))
|
||||
club = models.OneToOneField(Club, related_name='trombi')
|
||||
|
||||
objects = TrombiManager()
|
||||
@ -98,6 +98,9 @@ class TrombiUser(models.Model):
|
||||
scrub_pict = models.ImageField(upload_to='trombi', verbose_name=_("scrub pict"), null=True, blank=True,
|
||||
help_text=_("The scrub picture you want in the trombi (warning: this picture may be published)"))
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user)
|
||||
|
||||
class TrombiComment(models.Model):
|
||||
"""
|
||||
This represent a comment given by someone to someone else in the same Trombi
|
||||
@ -111,3 +114,4 @@ class TrombiComment(models.Model):
|
||||
if user.id == self.target.user.id:
|
||||
return False
|
||||
return user.id == self.author.user.id or user.can_edit(self.author.trombi)
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
{% block content %}
|
||||
<h2>{% trans club=object.club %}{{ club }}'s Trombi{% endtrans %}</h2>
|
||||
<a href="{{ url('trombi:edit', trombi_id=object.id) }}">Edit</a>
|
||||
<p>Subscription deadline: {{ object.subscription_deadline|date(DATETIME_FORMAT) }}</p>
|
||||
<p>Comment deadline: {{ object.comments_deadline|date(DATETIME_FORMAT) }}</p>
|
||||
<a href="{{ url('trombi:edit', trombi_id=object.id) }}">{% trans %}Edit{% endtrans %}</a>
|
||||
<p>{% trans %}Subscription deadline: {% endtrans %}{{ object.subscription_deadline|date(DATETIME_FORMAT) }}</p>
|
||||
<p>{% trans %}Comment deadline: {% endtrans %}{{ object.comments_deadline|date(DATETIME_FORMAT) }}</p>
|
||||
<a href="#">Export</a>
|
||||
<hr>
|
||||
<div>
|
||||
@ -24,7 +24,7 @@
|
||||
<img src="{{ file }}" alt="" style="max-width: 100px">
|
||||
</div>
|
||||
<div>{{ u.user.get_display_name() }}</div>
|
||||
<div><a href="{{ url('trombi:delete_user', trombi_id=object.id, user_id=u.id) }}">Delete</a></div>
|
||||
<div><a href="{{ url('trombi:delete_user', trombi_id=object.id, user_id=u.id) }}">{% trans %}Delete{% endtrans %}</a></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -14,8 +14,8 @@
|
||||
</form>
|
||||
{% else %}
|
||||
<p>{% trans trombi = user.trombi_user.trombi %}You are subscribed to the Trombi {{ trombi }}{% endtrans %}</p>
|
||||
<p><a href="{{ url("trombi:profile") }}">Edit my profile</a></p>
|
||||
<p><a href="{{ url("trombi:pictures") }}">Edit my pictures</a></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>
|
||||
<div>
|
||||
{% for u in user.trombi_user.trombi.users.exclude(id=user.trombi_user.id) %}
|
||||
@ -32,9 +32,9 @@
|
||||
<div>{{ u.user.get_display_name() }}</div>
|
||||
{% set comment = u.received_comments.filter(author__id=user.trombi_user.id).first() %}
|
||||
{% if comment %}
|
||||
<a href="{{ url("trombi:edit_comment", comment_id=comment.id) }}">Edit comment</a>
|
||||
<a href="{{ url("trombi:edit_comment", comment_id=comment.id) }}">{% trans %}Edit comment{% endtrans %}</a>
|
||||
{% else %}
|
||||
<a href="{{ url("trombi:new_comment", user_id=u.id) }}">Comment</a>
|
||||
<a href="{{ url("trombi:new_comment", user_id=u.id) }}">{% trans %}Comment{% endtrans %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
@ -72,7 +72,10 @@ class TrombiEditView(CanEditPropMixin, UpdateView):
|
||||
template_name = 'core/edit.jinja'
|
||||
pk_url_kwarg = 'trombi_id'
|
||||
|
||||
class TrombiDetailView(CanEditMixin, DetailView):
|
||||
def get_success_url(self):
|
||||
return super(TrombiEditView, self).get_success_url()+"?qn_success"
|
||||
|
||||
class TrombiDetailView(CanEditMixin, QuickNotifMixin, DetailView):
|
||||
model = Trombi
|
||||
template_name = 'trombi/detail.jinja'
|
||||
pk_url_kwarg = 'trombi_id'
|
||||
@ -87,7 +90,7 @@ class TrombiDeleteUserView(CanEditPropMixin, SingleObjectMixin, RedirectView):
|
||||
user = get_object_or_404(TrombiUser, id=self.kwargs['user_id'])
|
||||
user.delete()
|
||||
# See if we need to also delete the comments on the user, or if we keep them
|
||||
return redirect(self.object.get_absolute_url())
|
||||
return redirect(self.object.get_absolute_url()+"?qn_success")
|
||||
|
||||
# User side
|
||||
class UserTrombiForm(forms.Form):
|
||||
|
Loading…
Reference in New Issue
Block a user