From 6764224856329c79525710f0f40067b12303ce2d Mon Sep 17 00:00:00 2001 From: Skia Date: Fri, 24 Feb 2017 01:49:48 +0100 Subject: [PATCH] Fix quote answer and unread messages display --- core/static/core/style.css | 6 +++++- core/templatetags/renderer.py | 2 +- forum/templates/forum/topic.jinja | 18 +++++++++--------- forum/views.py | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/core/static/core/style.css b/core/static/core/style.css index a99dc417..293a12f7 100644 --- a/core/static/core/style.css +++ b/core/static/core/style.css @@ -203,7 +203,11 @@ ul, ol { code { font-family: monospace; } - +blockquote { + margin: 10px; + padding: 5px; + border: solid 1px black; +} .edit-bar { display: block; margin: 4px; diff --git a/core/templatetags/renderer.py b/core/templatetags/renderer.py index 7fe51098..fdda2b90 100644 --- a/core/templatetags/renderer.py +++ b/core/templatetags/renderer.py @@ -10,7 +10,7 @@ register = template.Library() @register.filter(is_safe=False) @stringfilter def markdown(text): - return mark_safe(md(escape(text))) + return mark_safe(md(text)) @register.filter() @stringfilter diff --git a/forum/templates/forum/topic.jinja b/forum/templates/forum/topic.jinja index 0d61435e..827e8907 100644 --- a/forum/templates/forum/topic.jinja +++ b/forum/templates/forum/topic.jinja @@ -36,18 +36,18 @@

{{ topic.title }}

{{ topic.description }}

Reply

- {% set unread = False %} + + {% set vars = {'unread': False} %} {# ugly hack to counter Jinja scopes #} {% for m in topic.messages.all() %} - {% if m.id == first_unread_message_id %} -
- {% set unread = True %} - {% elif unread %} -
+ {% if m.id == first_unread_message_id and vars.update({'unread': True}) %} {# idem #} +
+ {% elif vars.unread %} +
{% else %} -
+
{% endif %} -
- {% if m.author.profile_pict %} +
+ {% if m.author.profile_pict %} {% trans %}Profile{% endtrans %} {% else %} {% trans %}Profile{% endtrans %} diff --git a/forum/views.py b/forum/views.py index bfaa54c7..6e6210d0 100644 --- a/forum/views.py +++ b/forum/views.py @@ -148,7 +148,7 @@ class ForumMessageCreateView(CanCreateMixin, CreateView): init = super(ForumMessageCreateView, self).get_initial() try: init['message'] = "\n".join([ - " > " + line for line in ForumMessage.objects.filter(id=self.request.GET['quote_id']).first().message.split('\n') + "> " + line for line in ForumMessage.objects.filter(id=self.request.GET['quote_id']).first().message.split('\n') ]) except: pass return init