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/wmd/showdown.js" %}'></script>
8 <script type='text/javascript' src='{% media "/media/js/wmd/wmd.js" %}'></script>
9 <link rel="stylesheet" type="text/css" href="{% media "/media/js/wmd/wmd.css" %}" />
10 <script type="text/html" id="question-summary-template">
11 <div class="answer-summary">
12 <a href="%URL%"><div class="answer-votes">%SCORE%</div></a>
13 <div class="answer-link">
14 <a class="question-hyperlink" href="%URL%" title="%SUMMARY%">%TITLE%</a>
18 <script type="text/javascript">
20 //set current module button style
21 $("#nav_ask").attr('className',"on");
22 $('#editor').TextAreaResizer();
24 //toggle preview of editor
25 //todo remove copy-paste
27 var txt = "[{% trans "hide preview" %}]";
28 $('#pre-collapse').text(txt);
29 $('#pre-collapse').bind('click', function(){
30 txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
32 $('#previewer').toggle();
33 $('#pre-collapse').text(txt);
36 //Tags autocomplete action
37 $("#id_tags").autocomplete("/matching_tags", {
42 multipleSeparator: " ",
43 /*formatItem: function(row, i, max) {
44 return row.n + " ("+ row.c +")";
46 formatResult: function(row, i, max){
49 formatItem: function(row, i, max, value) {
50 return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
53 formatResult: function(row, i, max, value){
60 var related_questions_url = "{% url related_questions %}";
62 <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
66 <div id="main-bar" class="headNormal">
67 {% trans "Ask a question" %}
69 <div id="main-body" class="ask-body">
71 <form id="fmask" action="" method="post" >
72 {% if not request.user.is_authenticated %}
74 <p>{% trans "login to post question info" %}</p>
77 {% ifequal settings.EMAIL_VALIDATION 'on' %}
78 {% if not request.user.email_isvalid %}
80 {% blocktrans with request.user.email as email %}must have valid {{email}} to post,
81 see {{email_validation_faq_url}}
87 <div class="form-item">
88 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
89 {{ form.title }} {{ form.title.errors }}
90 <div class="title-desc">
91 {{ form.title.help_text }}
94 <div id="ask-related-questions"></div>
95 <div class="form-item">
96 <div id="wmd-button-bar" class="wmd-panel"></div>
97 {{ form.text }} {{ form.text.errors }}
98 <div class="preview-toggle">
102 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
104 {% if settings.WIKI_ON %}
106 {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
113 <div id="previewer" class="wmd-preview"></div>
114 <span class="form-error"></span>
116 <div class="form-item">
117 <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/>
118 {{ form.tags }} {{ form.tags.errors }}
120 <p class="title-desc">
121 {{ form.tags.help_text }}
123 {% if not request.user.is_authenticated %}
124 <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
126 <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
134 {% include "question_edit_tips.html" %}
139 <!-- end template ask.html -->