Commit 457fc36e authored by Skia's avatar Skia

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

Signed-off-by: Skia's avatarSkia <skia@libskia.so>
parent 1bcde80a
Pipeline #1046 failed with stage
in 5 minutes and 5 seconds
......@@ -470,13 +470,11 @@ em {
border: solid #333 2px;
}
/*---------------------------------PAGE--------------------------------*/
/*-------------------------------MARKDOWN------------------------------*/
.page_content {
display: block;
margin: 10px;
padding: 10px;
background: $white-color;
.markdown {
margin: 0px;
padding: 0px;
code {
font-family: monospace;
color: $white-color;
......@@ -487,8 +485,16 @@ em {
}
}
/*---------------------------------PAGE--------------------------------*/
.page_content {
display: block;
margin: 10px;
padding: 10px;
background: $white-color;
}
textarea {
white-space: pre;
width: 98%;
margin-top: 10px;
}
......
......@@ -36,7 +36,7 @@ register = template.Library()
@register.filter(is_safe=False)
@stringfilter
def markdown(text):
return mark_safe(md(text))
return mark_safe("<div class=\"markdown\">%s</div>" % md(text))
@register.filter()
@stringfilter
......@@ -57,4 +57,4 @@ def scss(path):
Return path of the corresponding css file after compilation
"""
processor = ScssProcessor(path)
return processor.get_converted_scss()
\ No newline at end of file
return processor.get_converted_scss()
......@@ -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>
......
......@@ -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
This diff is collapsed.
......@@ -318,6 +318,9 @@ SITH_CLUB_REFOUND_ID = 89
SITH_COUNTER_REFOUND_ID = 38
SITH_PRODUCT_REFOUND_ID = 5
# Pages
SITH_CORE_PAGE_SYNTAX = "Aide_sur_la_syntaxe"
# Forum
SITH_FORUM_PAGE_LENGTH = 30
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment