]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/ask.html
deleting the test file
[osqa.git] / forum / skins / default / templates / ask.html
1 {% extends "base.html" %}
2 <!-- template ask.html -->
3 {% load i18n %}
4 {% load extra_tags %}
5 {% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
6 {% block forejs %}
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">
14         $().ready(function(){
15             //set current module button style
16             $("#nav_ask").attr('className',"on");
17             $('#editor').TextAreaResizer();
18
19             //highlight code synctax when editor has new text
20             $("#editor").typeWatch({highlight: false, wait: 3000,
21                              captureLength: 5, callback: lanai.highlightSyntax});
22
23             //toggle preview of editor
24                         //todo remove copy-paste
25             var display = true;
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" %}]";
30                 display = !display;
31                 $('#previewer').toggle();
32                 $('#pre-collapse').text(txt);
33             });
34
35             //Tags autocomplete action
36             var tags = {{ tags|safe }};
37                 $("#id_tags").autocomplete(tags, {
38                 minChars: 1,
39                         matchContains: true,
40                 max: 20,
41                 multiple: true,
42                 multipleSeparator: " ",
43                         formatItem: function(row, i, max) {
44                                 return row.n + " ("+ row.c +")";
45                         },
46                 formatResult: function(row, i, max){
47                     return row.n;
48                 }
49
50             });
51
52             setupFormValidation("#fmask", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
53             lanai.highlightSyntax();
54
55         });
56         </script>
57 {% endblock %}
58
59 {% block content %}
60 <div id="main-bar" class="headNormal">
61         {% trans "Ask a question" %}
62 </div>
63 <div id="main-body" class="ask-body">
64     <div id="askform">
65         <form id="fmask" action="" method="post" >
66                         {% if not request.user.is_authenticated %}
67             <div class="message">
68                             <p>{% trans "login to post question info" %}</p>
69             </div>
70             {% else %}
71                 {% ifequal settings.EMAIL_VALIDATION 'on' %}
72                     {% if not request.user.email_isvalid %}
73                         <div class="message">
74                             {% blocktrans with request.user.email as email %}must have valid {{email}} to post, 
75                             see {{email_validation_faq_url}}
76                             {% endblocktrans %}
77                         </div>
78                     {% endif %}
79                 {% endifequal %}
80                         {% endif %}
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 }}
86                 </div>
87             </div>
88
89             <div class="form-item">
90                 <div id="wmd-button-bar" class="wmd-panel"></div>
91                 {{ form.text }}
92
93                 <div class="preview-toggle">
94                     <table width="100%">
95                         <tr>
96                             <td>
97                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
98                             </td>
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>
102                             </td>
103                             {% endif %}
104                         </tr>
105
106                     </table>
107                 </div>
108                 <div id="previewer" class="wmd-preview"></div>
109                 <span class="form-error"></span>
110             </div>
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 }}
114             </div>
115                         <p class="title-desc">
116                                 {{ form.tags.help_text }}
117                         </p>
118             {% if not request.user.is_authenticated %}
119             <input type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
120                         {% else %}
121             <input type="submit" value="{% trans "Ask your question" %}" class="submit" />
122             {% endif %}
123         </form>
124     </div>
125 </div>
126 {% endblock %}
127
128 {% block sidebar %}
129 {% include "question_edit_tips.html" %}
130 {% endblock %}
131
132 {% block endjs %}
133 {% endblock %}
134 <!-- end template ask.html -->