1 {% extends "base.html" %}
2 <!-- template ask.html -->
5 {% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
7 <script type='text/javascript' src='{% media "/media/js/com.cnprog.editor.js" %}'></script>
8 <script type='text/javascript' src='{% media "/media/js/com.cnprog.post.js" %}'></script>
9 <script type='text/javascript' src='{% media "/media/js/jquery.validate.pack.js" %}'></script>
10 <script type='text/javascript' src='{% media "/media/js/wmd/showdown.js" %}'></script>
11 <script type='text/javascript' src='{% media "/media/js/wmd/wmd.js" %}'></script>
12 <link rel="stylesheet" type="text/css" href="{% media "/media/js/wmd/wmd.css" %}" />
13 <script type="text/javascript">
15 //set current module button style
16 $("#nav_ask").attr('className',"on");
17 $('#editor').TextAreaResizer();
19 //highlight code synctax when editor has new text
20 $("#editor").typeWatch({highlight: false, wait: 3000,
21 captureLength: 5, callback: lanai.highlightSyntax});
23 //toggle preview of editor
24 //todo remove copy-paste
26 var txt = "[{% trans "hide preview" %}]";
27 $('#pre-collapse').text(txt);
28 $('#pre-collapse').bind('click', function(){
29 txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
31 $('#previewer').toggle();
32 $('#pre-collapse').text(txt);
35 //Tags autocomplete action
36 var tags = {{ tags|safe }};
37 $("#id_tags").autocomplete(tags, {
42 multipleSeparator: " ",
43 formatItem: function(row, i, max) {
44 return row.n + " ("+ row.c +")";
46 formatResult: function(row, i, max){
52 setupFormValidation("#fmask", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
53 lanai.highlightSyntax();
60 <div id="main-bar" class="headNormal">
61 {% trans "Ask a question" %}
63 <div id="main-body" class="ask-body">
65 <form id="fmask" action="" method="post" >
66 {% if not request.user.is_authenticated %}
68 <p>{% trans "login to post question info" %}</p>
71 {% ifequal settings.EMAIL_VALIDATION 'on' %}
72 {% if not request.user.email_isvalid %}
74 {% blocktrans with request.user.email as email %}must have valid {{email}} to post,
75 see {{email_validation_faq_url}}
81 <div class="form-item">
82 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
83 {{ form.title }} {{ form.title.errors }}
84 <div class="title-desc">
85 {{ form.title.help_text }}
89 <div class="form-item">
90 <div id="wmd-button-bar" class="wmd-panel"></div>
93 <div class="preview-toggle">
97 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
99 {% if settings.WIKI_ON %}
100 <td style="text-align:right;">
101 {{ form.wiki }} <span style="font-weight:normal;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
108 <div id="previewer" class="wmd-preview"></div>
109 <span class="form-error"></span>
111 <div class="form-item">
112 <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/>
113 {{ form.tags }} {{ form.tags.errors }}
115 <p class="title-desc">
116 {{ form.tags.help_text }}
118 {% if not request.user.is_authenticated %}
119 <input type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
121 <input type="submit" value="{% trans "Ask your question" %}" class="submit" />
129 {% include "question_edit_tips.html" %}
134 <!-- end template ask.html -->