mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Again, lot of forum improvements
This commit is contained in:
@ -23,14 +23,14 @@
|
||||
{% if forum.children.exists() %}
|
||||
<div>
|
||||
<div class="ib w_big">
|
||||
Title
|
||||
{% trans %}Title{% endtrans %}
|
||||
</div>
|
||||
<div class="ib w_small">
|
||||
<div class="ib w_medium">
|
||||
Topics
|
||||
{% trans %}Topics{% endtrans %}
|
||||
</div>
|
||||
<div class="ib w_small">
|
||||
Last message
|
||||
{% trans %}Last message{% endtrans %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,17 +41,17 @@
|
||||
{% if topics %}
|
||||
<div>
|
||||
<div class="ib w_medium">
|
||||
Title
|
||||
{% trans %}Title{% endtrans %}
|
||||
</div>
|
||||
<div class="ib w_medium">
|
||||
<div class="ib w_small">
|
||||
Author
|
||||
{% trans %}Author{% endtrans %}
|
||||
</div>
|
||||
<div class="ib w_medium">
|
||||
Messages
|
||||
{% trans %}Messages{% endtrans %}
|
||||
</div>
|
||||
<div class="ib w_small">
|
||||
Last message
|
||||
{% trans %}Last message{% endtrans %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -71,3 +71,57 @@
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro display_message(m, user, unread=False) %}
|
||||
{% if user.can_view(m) %}
|
||||
<div id="msg_{{ m.id }}" class="message {% if unread %}unread{% endif %}">
|
||||
<div class="msg_author {% if m.deleted %}deleted{% endif %}">
|
||||
{% if m.author.avatar_pict %}
|
||||
<img src="{{ m.author.avatar_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
|
||||
{% else %}
|
||||
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
|
||||
{% endif %}
|
||||
<br/>
|
||||
<strong><a href="{{ m.author.get_absolute_url() }}">{{ m.author.get_short_name() }}</a></strong>
|
||||
</div>
|
||||
<div class="msg_content {% if m.deleted %}deleted{% endif %}" {% if m.id == first_unread_message_id %}id="first_unread"{% endif %}>
|
||||
<div style="display: inline-block; width: 74%;">
|
||||
{% if m.title %}
|
||||
<h5>{{ m.title }}</h5>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="display: inline-block; width: 25%;">
|
||||
<span><a href="{{ url('forum:new_message', topic_id=m.topic.id) }}?quote_id={{ m.id }}">
|
||||
{% trans %}Reply as quote{% endtrans %}</a></span>
|
||||
{% if user.can_edit(m) %}
|
||||
<span> <a href="{{ url('forum:edit_message', message_id=m.id) }}">{% trans %}Edit{% endtrans %}</a></span>
|
||||
{% endif %}
|
||||
{% if m.can_be_moderated_by(user) %}
|
||||
{% if m.deleted %}
|
||||
<span> <a href="{{ url('forum:undelete_message', message_id=m.id) }}">{% trans %}Undelete{% endtrans %}</a></span>
|
||||
{% else %}
|
||||
<span> <a href="{{ url('forum:delete_message', message_id=m.id) }}">{% trans %}Delete{% endtrans %}</a></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<br/>
|
||||
<span>{{ m.date|localtime|date(DATETIME_FORMAT) }} {{ m.date|localtime|time(DATETIME_FORMAT) }}</span>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
{{ m.message|markdown }}
|
||||
</div>
|
||||
{% if m.can_be_moderated_by(user) %}
|
||||
<ul class="msg_meta">
|
||||
{% for meta in m.metas.select_related('user').order_by('id') %}
|
||||
<li style="background: {% if m.author == meta.user %}#bfffbf{% else %}#ffffbf{% endif %}">
|
||||
{{ meta.get_action_display() }} {{ meta.user.get_display_name() }}
|
||||
{% trans %} at {% endtrans %}{{ meta.date|localtime|time(DATETIME_FORMAT) }}
|
||||
{% trans %} the {% endtrans %}{{ meta.date|localtime|date(DATETIME_FORMAT)}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{{ m.mark_as_read(user) or "" }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
|
35
forum/templates/forum/reply.jinja
Normal file
35
forum/templates/forum/reply.jinja
Normal file
@ -0,0 +1,35 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'forum/macros.jinja' import display_message %}
|
||||
|
||||
{% block title %}
|
||||
{% trans %}Reply{% endtrans %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
<a href="{{ url('forum:main') }}">{% trans %}Forum{% endtrans %}</a>
|
||||
{% for f in topic.forum.get_parent_list() %}
|
||||
> <a href="{{ f.get_absolute_url() }}">{{ f }}</a>
|
||||
{% endfor %}
|
||||
> <a href="{{ topic.forum.get_absolute_url() }}">{{ topic.forum }}</a>
|
||||
> <a href="{{ topic.get_absolute_url() }}">{{ topic }}</a>
|
||||
</p>
|
||||
<h3>{{ topic.title }}</h3>
|
||||
<h4>{% trans %}Reply{% endtrans %}</h4>
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p() }}
|
||||
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
|
||||
{% for m in topic.messages.select_related('author__avatar_pict').order_by('-id') %}
|
||||
{{ display_message(m, user) }}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
{% extends "core/base.jinja" %}
|
||||
{% from 'core/macros.jinja' import user_profile_link %}
|
||||
{% from 'forum/macros.jinja' import display_message %}
|
||||
|
||||
{% block title %}
|
||||
{{ topic }}
|
||||
@ -35,66 +36,17 @@
|
||||
</p>
|
||||
<h3>{{ topic.title }}</h3>
|
||||
<p>{{ topic.description }}</p>
|
||||
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">Reply</a></p>
|
||||
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
|
||||
|
||||
{% for m in topic.messages.select_related('author__avatar_pict').all() %}
|
||||
{% if user.can_view(m) %}
|
||||
{% if m.id >= first_unread_message_id %}
|
||||
<div id="msg_{{ m.id }}" class="message unread">
|
||||
{% else %}
|
||||
<div id="msg_{{ m.id }}" class="message">
|
||||
{% endif %}
|
||||
<div class="msg_author {% if m.deleted %}deleted{% endif %}">
|
||||
{% if m.author.avatar_pict %}
|
||||
<img src="{{ m.author.avatar_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
|
||||
{% else %}
|
||||
<img src="{{ static('core/img/unknown.jpg') }}" alt="{% trans %}Profile{% endtrans %}" id="picture" />
|
||||
{% endif %}
|
||||
<br/>
|
||||
<strong><a href="{{ m.author.get_absolute_url() }}">{{ m.author.get_short_name() }}</a></strong>
|
||||
</div>
|
||||
<div class="msg_content {% if m.deleted %}deleted{% endif %}" {% if m.id == first_unread_message_id %}id="first_unread"{% endif %}>
|
||||
<div style="display: inline-block; width: 74%;">
|
||||
{% if m.title %}
|
||||
<h5>{{ m.title }}</h5>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="display: inline-block; width: 25%;">
|
||||
<span><a href="{{ url('forum:new_message', topic_id=topic.id) }}?quote_id={{ m.id }}">
|
||||
{% trans %}Reply as quote{% endtrans %}</a></span>
|
||||
{% if user.can_edit(m) %}
|
||||
<span> <a href="{{ url('forum:edit_message', message_id=m.id) }}">{% trans %}Edit{% endtrans %}</a></span>
|
||||
{% endif %}
|
||||
{% if m.can_be_moderated_by(user) %}
|
||||
{% if m.deleted %}
|
||||
<span> <a href="{{ url('forum:undelete_message', message_id=m.id) }}">{% trans %}Undelete{% endtrans %}</a></span>
|
||||
{% else %}
|
||||
<span> <a href="{{ url('forum:delete_message', message_id=m.id) }}">{% trans %}Delete{% endtrans %}</a></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<br/>
|
||||
<span>{{ m.date|localtime|date(DATETIME_FORMAT) }} {{ m.date|localtime|time(DATETIME_FORMAT) }}</span>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
{{ m.message|markdown }}
|
||||
</div>
|
||||
{% if m.can_be_moderated_by(user) %}
|
||||
<ul class="msg_meta">
|
||||
{% for meta in m.metas.select_related('user').order_by('id') %}
|
||||
<li style="background: {% if m.author == meta.user %}#bfffbf{% else %}#ffffbf{% endif %}">
|
||||
{{ meta.get_action_display() }} {{ meta.user.get_display_name() }}
|
||||
{% trans %} at {% endtrans %}{{ meta.date|localtime|time(DATETIME_FORMAT) }}
|
||||
{% trans %} the {% endtrans %}{{ meta.date|localtime|date(DATETIME_FORMAT)}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{{ m.mark_as_read(user) or "" }}
|
||||
{% endif %}
|
||||
{% if m.id >= first_unread_message_id %}
|
||||
{{ display_message(m, user, True) }}
|
||||
{% else %}
|
||||
{{ display_message(m, user, False) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">Reply</a></p>
|
||||
|
||||
<p><a href="{{ url('forum:new_message', topic_id=topic.id) }}">{% trans %}Reply{% endtrans %}</a></p>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user