Fix markdown rendering on some pages, and add a link to the syntax help

Signed-off-by: Skia <skia@libskia.so>
This commit is contained in:
Skia
2017-06-10 16:52:03 +02:00
parent 1bcde80a28
commit 457fc36e16
6 changed files with 166 additions and 141 deletions

View File

@ -27,7 +27,11 @@
{% endif %}
<form action="" method="post" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p() }}
<p>{{ form.title.errors }}<label for="{{ form.title.name }}">{{ form.title.label }}</label> {{ form.title }}</p>
<p>{{ form.message.errors }}<label for="{{ form.message.name }}">{{ form.message.label }}</label> </p>
<p class="markdown_editor"><a href="{{ syntax_help_page.get_absolute_url() }}">{% trans %}Help on the syntax{% endtrans %}</a>
{{ form.message }}
</p>
<p><input type="button" value="{% trans %}Preview{% endtrans %}" onclick="javascript:make_preview();" /></p>
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
</form>
@ -43,7 +47,7 @@
</div>
<div class="msg_content">
<hr>
<div id="preview" class="ib w_big"></div>
<div id="preview" class="ib"></div>
<div class="forum_signature">{{ user.forum_signature|markdown }}</div>
</div>
</div>

View File

@ -38,6 +38,7 @@ from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from ajax_select import make_ajax_form, make_ajax_field
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, CanCreateMixin, TabedViewMixin
from core.models import Page
from forum.models import Forum, ForumMessage, ForumTopic, ForumMessageMeta
class ForumMainView(ListView):
@ -215,6 +216,7 @@ class ForumMessageEditView(CanEditMixin, UpdateView):
def get_context_data(self, **kwargs):
kwargs = super(ForumMessageEditView, self).get_context_data(**kwargs)
kwargs['topic'] = self.object.topic
kwargs['syntax_help_page'] = Page.get_page_by_full_name(settings.SITH_CORE_PAGE_SYNTAX)
return kwargs
class ForumMessageDeleteView(SingleObjectMixin, RedirectView):
@ -271,5 +273,6 @@ class ForumMessageCreateView(CanCreateMixin, CreateView):
def get_context_data(self, **kwargs):
kwargs = super(ForumMessageCreateView, self).get_context_data(**kwargs)
kwargs['topic'] = self.topic
kwargs['syntax_help_page'] = Page.get_page_by_full_name(settings.SITH_CORE_PAGE_SYNTAX)
return kwargs