]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/ask.html
OSQA-349
[osqa.git] / forum / skins / default / templates / ask.html
1 {% extends "base.html" %}
2 <!-- template ask.html -->
3 {% load i18n extra_tags extra_filters %}
4 {% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %}
5 {% block forejs %}
6         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>
7         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>
8         <link rel="stylesheet" type="text/css" href="{% media  "/media/js/wmd/wmd.css" %}" />
9         <script type="text/html" id="question-summary-template">
10             <div class="answer-summary">
11                 <a href="%URL%"><div class="answer-votes">%SCORE%</div></a>
12                 <div class="answer-link">
13                     <a class="question-hyperlink" href="%URL%" title="%SUMMARY%">%TITLE%</a>
14                 </div>
15             </div>
16         </script>
17         <script type="text/javascript">
18         $(function(){
19             //set current module button style
20             $("#nav_ask").attr('className',"on");
21             $('#editor').TextAreaResizer();
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                 $("#id_tags").autocomplete("/matching_tags/", {
37                 minChars: 1,
38                         matchContains: true,
39                 max: 20,
40                 multiple: true,
41                 multipleSeparator: " ",
42                         /*formatItem: function(row, i, max) {
43                                 return row.n + " ("+ row.c +")";
44                         },
45                 formatResult: function(row, i, max){
46                     return row.n;
47                 }*/
48                 formatItem: function(row, i, max, value) {
49                     return row[1].split(".")[0] + " (" + row[1].split(".")[1] + ")";
50                 },
51
52                 formatResult: function(row, i, max, value){
53                     return row[0];
54                 }
55
56             });
57         });
58
59         var related_questions_url = "{% url related_questions %}";
60         </script>
61         <script src="{% media "/media/js/osqa.ask.js" %}" type="text/javascript"></script>
62 {% endblock %}
63
64 {% block content %}
65 <div id="main-bar" class="headNormal">
66         {% trans "Ask a question" %}
67 </div>
68 <div id="main-body" class="ask-body">
69     <div id="askform">
70         <form id="fmask" action="" method="post" accept-charset="utf-8">
71                         {% if not request.user.is_authenticated %}
72             <div class="message">
73                 <span class="strong big">{% trans "You are welcome to start submitting your question anonymously." %}</span>
74                 <p>{% blocktrans %}
75                     After submiting your question, you will be redirected to the login/signup page.
76                     Your question will be saved in the current session and will be published after you login with your existing account,
77                     or signup for a new account{% endblocktrans %}{% if "ask"|contained_in:settings.REQUIRE_EMAIL_VALIDATION_TO %}
78                     {% trans "and validate your email." %}{% else %}.{% endif %}</p>
79             </div>
80             {% else %}
81                 {% if not request.user.email_valid_and_can_ask %}
82                     <div class="message">
83                         {% blocktrans %}Remember, your question will not be published until you validate your email.{% endblocktrans %}
84                         <a href="{% url send_validation_email %}">{% trans "Send me a validation link." %}</a>
85                     </div>
86                 {% endif %}
87                         {% endif %}
88             <div class="form-item">
89                 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
90                 {{ form.title }} {{ form.title.errors }}
91                 <div class="title-desc">
92                     {{ form.title.help_text }}
93                 </div>
94             </div>
95             <div id="ask-related-questions"></div>
96             <div class="form-item">
97                 <div id="wmd-button-bar" class="wmd-panel"></div>
98                 {{ form.text }} {{ form.text.errors }}
99                 <div class="preview-toggle">
100                     <table width="100%">
101                         <tr>
102                             <td>
103                                 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
104                             </td>
105                             {% if settings.WIKI_ON %}
106                             <td class="tright">
107                                 {{ form.wiki }} <span class="help_text" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
108                             </td>
109                             {% endif %}
110                         </tr>
111
112                     </table>
113                 </div>
114                 <div id="previewer" class="wmd-preview"></div>
115                 <span class="form-error"></span>
116             </div>
117             <div class="form-item">
118                 <strong>{{ form.tags.label_tag }}:</strong> {% trans "(required)" %} <span class="form-error"></span><br/>
119                 {{ form.tags }}  {{ form.tags.errors }}
120             </div>
121                         <p class="title-desc">
122                                 {{ form.tags.help_text }}
123                         </p>
124             {% if not request.user.is_authenticated %}
125             <input name="ask" type="submit" value="{% trans "Login/signup to post your question" %}" class="submit" />
126                         {% else %}
127             <input name="ask" type="submit" value="{% trans "Ask your question" %}" class="submit" />
128             {% endif %}
129         </form>
130     </div>
131 </div>
132 {% endblock %}
133
134 {% block sidebar %}
135 {% include "question_edit_tips.html" %}
136 {% endblock %}
137
138 {% block endjs %}
139 {% endblock %}
140 <!-- end template ask.html -->