1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{% extends "two_column_body.html" %}
<!-- template ask.html -->
{% block title %}{% spaceless %}{% trans %}Ask a question{% endtrans %}{% endspaceless %}{% endblock %}
{% block forestyle %}
<link rel="stylesheet" type="text/css" href="{{"/js/wmd/wmd.css"|media}}" />
{% endblock %}
{# main contents of ask form is in the template input_bar #}
{% block sidebar %}
{% include "question_edit_tips.html" %}
{% endblock %}
{% block endjs %}
<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/jquery.validate.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/post.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script>
{% include "editor_data.html" %}
<script type='text/javascript'>
{% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %}
var codeFriendlyMarkdown = true;
{% else %}
var codeFriendlyMarkdown = false;
{% endif %}
var tags = {{ tags|safe }};
$().ready(function(){
//set current module button style
$('#editor').TextAreaResizer();
//highlight code synctax when editor has new text
$("#editor").typeWatch({highlight: false, wait: 3000,
captureLength: 5, callback: lanai.highlightSyntax});
//toggle preview of editor
//todo remove copy-paste
var display = true;
var txt = "[{% trans %}hide preview{% endtrans %}]";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
txt = display ? "[{% trans %}show preview{% endtrans %}]" : "[{% trans %}hide preview{% endtrans %}]";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
});
//Tags autocomplete action
$("#id_tags").autocomplete(tags, {
minChars: 1,
matchContains: true,
max: 20,
multiple: true,
multipleSeparator: " ",
formatItem: function(row, i, max) {
return row.n + " ("+ row.c +")";
},
formatResult: function(row, i, max){
return row.n;
}
});
setupFormValidation($("#fmask"), CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
lanai.highlightSyntax();
});
</script>
{% endblock %}
<!-- end template ask.html -->
|