]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/ask.html
fixes osqa-54: The user was not being informed that they were trying to submit a...
[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/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/javascript">
11         $().ready(function(){
12             //set current module button style
13             $("#nav_ask").attr('className',"on");
14             $('#editor').TextAreaResizer();
15
16             //toggle preview of editor
17                         //todo remove copy-paste
18             var display = true;
19             var txt = "[{% trans "hide preview" %}]";
20             $('#pre-collapse').text(txt);
21             $('#pre-collapse').bind('click', function(){
22                 txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";
23                 display = !display;
24                 $('#previewer').toggle();
25                 $('#pre-collapse').text(txt);
26             });
27
28             // Tags autocomplete action
29                 $("#id_tags").autocomplete("/matching_tags", {
30                 minChars: 1,
31                         matchContains: true,
32                 max: 20,
33                 multiple: true,
34                 multipleSeparator: " ",
35                         /*formatItem: function(row, i, max) {
36                                 return row.n + " ("+ row.c +")";
37                         },
38                 formatResult: function(row, i, max){
39                     return row.n;
40                 }*/
41                 formatItem: function(row, i, max, value) {
42                     return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
43                 },
44
45                 formatResult: function(row, i, max, value){
46                     return row[0];
47                 }
48
49             });
50         });
51         </script>
52 {% endblock %}
53
54 {% block content %}
55 <div id="main-bar" class="headNormal">
56         {% trans "Ask a question" %}
57 </div>
58 <div id="main-body" class="ask-body">
59     <div id="askform">
60         <form id="fmask" action="" method="post" >
61                         {% if not request.user.is_authenticated %}
62             <div class="message">
63                             <p>{% trans "login to post question info" %}</p>
64             </div>
65             {% else %}
66                 {% ifequal settings.EMAIL_VALIDATION 'on' %}
67                     {% if not request.user.email_isvalid %}
68                         <div class="message">
69                             {% blocktrans with request.user.email as email %}must have valid {{email}} to post, 
70                             see {{email_validation_faq_url}}
71                             {% endblocktrans %}
72                         </div>
73                     {% endif %}
74                 {% endifequal %}
75                         {% endif %}
76             <div class="form-item">
77                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
78                 {{ form.title }} {{ form.title.errors }}
79                 <div class="title-desc">
80                     {{ form.title.help_text }}
81                 </div>
82             </div>
83
84             <div class="form-item">
85                 <div id="wmd-button-bar" class="wmd-panel"></div>
86                 {{ form.text }} {{ form.text.errors }}
87
88                 <div class="preview-toggle">
89                     <table width="100%">
90                         <tr>
91                             <td>
92                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
93                             </td>
94                             {% if settings.WIKI_ON %}
95                             <td class="tright">
96                                 {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
97                             </td>
98                             {% endif %}
99                         </tr>
100
101                     </table>
102                 </div>
103                 <div id="previewer" class="wmd-preview"></div>
104                 <span class="form-error"></span>
105             </div>
106             <div class="form-item">
107                 <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/>
108                 {{ form.tags }}  {{ form.tags.errors }}
109             </div>
110                         <p class="title-desc">
111                                 {{ form.tags.help_text }}
112                         </p>
113             {% if not request.user.is_authenticated %}
114             <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
115                         {% else %}
116             <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
117             {% endif %}
118         </form>
119     </div>
120 </div>
121 {% endblock %}
122
123 {% block sidebar %}
124 {% include "question_edit_tips.html" %}
125 {% endblock %}
126
127 {% block endjs %}
128 {% endblock %}
129 <!-- end template ask.html -->