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