]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/question.html
removing score sort option from the bulk management tool in the administration, it...
[osqa.git] / forum / skins / default / templates / question.html
1 {% extends "base.html" %}\r
2 <!-- question.html -->\r
3 {% load node_tags %}\r
4 {% load extra_tags %}\r
5 {% load extra_filters %}\r
6 {% load general_sidebar_tags %}\r
7 {% load smart_if %}\r
8 {% load humanize %}\r
9 {% load i18n %}\r
10 {% load cache %}\r
11 {% block metadescription %}{{ question.meta_description }}{% endblock %}\r
12 {% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %}\r
13 {% block meta %}\r
14         <link rel="canonical" href="{{settings.APP_BASE_URL}}{{question.get_absolute_url}}" />\r
15         <link rel="alternate" type="application/rss+xml" title="RSS" href="{{ question.get_absolute_url }}?type=rss">\r
16 {% endblock %}\r
17 {% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %}\r
18 {% block forejs %}\r
19         {% if not question.nis.closed %}\r
20         <script type='text/javascript' src='{% media  "/media/js/osqa.question.js" %}'></script>\r
21         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>\r
22         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>\r
23         <link rel="stylesheet" type="text/css" href="{% media  "/media/js/wmd/wmd.css" %}" />\r
24         {% endif %}\r
25 \r
26         <script type="text/javascript">\r
27         $().ready(function(){\r
28             $("#nav_questions").attr('className',"on");\r
29             var answer_sort_tab = "{{ tab_id }}";\r
30 \r
31             if (answer_sort_tab) {\r
32                 $("#" + answer_sort_tab).attr('className',"on");\r
33             }\r
34 \r
35             $('#editor').TextAreaResizer();\r
36 \r
37             //toggle preview of editor\r
38             var display = true;\r
39             var txt = "[{% trans "hide preview" %}]";\r
40             $('#pre-collapse').text(txt);\r
41             $('#pre-collapse').bind('click', function(){\r
42                 txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]";\r
43                 display = !display;\r
44                 $('#previewer').toggle();\r
45                 $('#pre-collapse').text(txt);\r
46             });\r
47         });\r
48 \r
49         function submitClicked(e, f) {\r
50             if(!(browserTester('chrome') || browserTester('safari'))) {\r
51                 $("input.submit")[0].disabled=true;\r
52             }\r
53             window.removeEventListener('beforeunload', beforeUnload, true);\r
54             if (f) {\r
55                 f.submit();\r
56             }\r
57         }\r
58 \r
59         function beforeUnload(e) {\r
60 \r
61             if($("textarea#editor")[0].value != "") {\r
62                 return yourWorkWillBeLost(e);\r
63             }\r
64 \r
65             var commentBoxes = $("textarea.commentBox");\r
66             for(var index = 0; index < commentBoxes.length; index++) {\r
67                 if(commentBoxes[index].value != "") {\r
68                     return yourWorkWillBeLost(e);\r
69                 }\r
70             }\r
71         }\r
72         window.addEventListener('beforeunload', beforeUnload, true);\r
73         </script>\r
74         <noscript>\r
75             <style>\r
76                 .comment.not_top_scorer {\r
77                     display: block;\r
78                 }\r
79                 .comment-form-container {\r
80                     display: block;\r
81                 }\r
82                 .div.comment-tools {\r
83                     display: none;\r
84                 }\r
85             </style>\r
86         </noscript>\r
87 {% endblock %}\r
88         \r
89 {% block content %}\r
90 <div class="headNormal">\r
91     <h1><a href="{{ question.get_absolute_url }}">{{ question.headline }}</a></h1>\r
92 </div>\r
93 <div id="main-body" class="">\r
94     <div id="askform">\r
95             <table style="width:100%;" id="question-table" {% post_classes question %}>\r
96                 <tr>\r
97                     <td style="width:30px;vertical-align:top">\r
98                         <div class="vote-buttons">\r
99                             {% vote_buttons question request.user %}\r
100                             {% favorite_mark question request.user %}                            \r
101                         </div>\r
102                     </td>\r
103                     <td>\r
104                         <div id="item-right">\r
105                             <div class="question-body">\r
106                                 {{ question.html|safe }}\r
107                             </div>\r
108                             <div id="question-tags" class="tags-container tags">\r
109                                 {% for tag in question.tagname_list %}\r
110                                     <a href="{% url tag_questions tag|urlencode %}" class="post-tag tag-link-{{ tag }}"\r
111                                         title="{% blocktrans with tag as tagname %}see questions tagged '{{ tagname }}'{% endblocktrans %}" rel="tag">{{ tag }}</a>\r
112                                 {% endfor %}\r
113                             </div>\r
114                             <div id="question-controls" class="post-controls">                            \r
115                                 {% post_controls question request.user %}\r
116                                 {% wiki_symbol request.user question %}\r
117                             </div>\r
118                             <div class="post-update-info-container">\r
119                                     {% contributors_info question %}\r
120                             </div>\r
121                             {% comments question request.user %}\r
122                         </div>\r
123                         \r
124                     </td>\r
125                 </tr>\r
126             </table>\r
127             {% if question.nis.closed %}\r
128             <div class="question-status" style="margin-bottom:15px">\r
129             <h3>\r
130                 {% blocktrans with question.nstate.closed.extra as close_reason %}The question has been closed for the following reason "{{ close_reason }}" by{% endblocktrans %}\r
131                 <a href="{{ question.nstate.closed.by.get_profile_url }}">{{ question.nstate.closed.by.username }}</a>\r
132                  {% diff_date question.nstate.closed.at %}\r
133             </h3>\r
134             </div>\r
135             {% endif %}\r
136             {% if answers %}\r
137                 <hr/>\r
138                 <div class="tabBar">\r
139                     <a name="sort-top"></a>\r
140                     <div class="headQuestions">\r
141                     {% blocktrans count answers.paginator.count as counter %}One Answer:{% plural %}{{counter}} Answers:{% endblocktrans %}\r
142                     </div>\r
143                     {{ answers.paginator.sort_tabs }}\r
144                 </div>\r
145                 {{ answers.paginator.page_numbers }}\r
146   \r
147                 {% for answer in answers.paginator.page %}\r
148                     <a name="{{ answer.id }}"></a>\r
149                     <div id="answer-container-{{ answer.id }}" class="answer {% post_classes answer %}">\r
150                         <table style="width:100%;">\r
151                             <tr>\r
152                                 <td style="width:30px;vertical-align:top">\r
153                                     <div class="vote-buttons">\r
154                                         {% vote_buttons answer request.user %}\r
155                                         {% accept_button answer request.user %}\r
156                                     </div>\r
157                                 </td>\r
158                                 <td>\r
159                                     <div class="item-right">\r
160                                         <div class="answer-body">\r
161                                             {{ answer.html|safe }}\r
162                                         </div>\r
163                                         <div class="answer-controls post-controls">\r
164                                             {% post_controls answer request.user %}\r
165                                             {% wiki_symbol request.user answer %}\r
166                                         </div>\r
167                                         <div class="post-update-info-container">\r
168                                             {% contributors_info answer %}\r
169                                         </div>\r
170                                         {% comments answer request.user %}\r
171                                     </div>\r
172                                 </td>\r
173                             </tr>\r
174                         </table>\r
175                     </div>\r
176                 {% endfor %}\r
177                 <div class="paginator-container-left">\r
178                     {{ answers.paginator.page_numbers }}\r
179                 </div>\r
180             {% endif %}\r
181         <form id="fmanswer" action="{% url answer question.id %}" method="post">\r
182             {% csrf_token %}\r
183             <div style="clear:both">\r
184             </div>\r
185             \r
186             {% if not question.closed %}\r
187                 <div style="padding:10px 0 0 0;">\r
188                     {% spaceless %}\r
189                     <div class="headNormal">\r
190                         {% if answers %}\r
191                             {% trans "Your answer" %}\r
192                         {% else %}\r
193                             {% trans "Be the first one to answer this question!" %}\r
194                         {% endif %}\r
195                     </div>\r
196                     {% endspaceless %}\r
197                 </div>\r
198                 {% comment %}\r
199                 {% if not request.user.is_authenticated %}\r
200                     <div class="message">{% trans "You can answer anonymously and then login." %}</div>\r
201                 {% else %}\r
202                     <p class="message">\r
203                         {% ifequal request.user question.author  %}\r
204                             {% trans "Answer your own question only to give an answer." %}\r
205                         {% else %}\r
206                             {% trans "Please only give an answer, no discussions." %}\r
207                         {% endifequal %}\r
208                         {% if not request.user.email_valid_and_can_answer %}\r
209                             {% blocktrans %}Remember, your answer will not be published until you validate your email.{% endblocktrans %}\r
210                             <a href="{% url send_validation_email %}">{% trans "Send me a validation link." %}</a>\r
211                         {% endif %}\r
212                     </p>\r
213                 {% endif %}\r
214                 {% endcomment %}\r
215 \r
216                 <div id="description" class="" >\r
217                     <div id="wmd-button-bar" class="wmd-panel"></div>\r
218                     {{ answer.text }}\r
219                     <div class="preview-toggle">\r
220                         <table width="100%">\r
221                             <tr>\r
222                                 <td>\r
223                                     <span id="pre-collapse" \r
224                                         title="{% trans "Toggle the real time Markdown editor preview" %}">\r
225                                             {% trans "toggle preview" %}\r
226                                     </span>\r
227                                 </td>\r
228                                 <td style="text-align: right;" id="editor-metrics"></td>\r
229                                 {% if settings.WIKI_ON %}\r
230                                 <td style="text-align:right;">\r
231                                     {{ answer.wiki }} \r
232                                     <span style="font-weight:normal;cursor:help" \r
233                                         title="{{answer.wiki.help_text}}">\r
234                                             {{ answer.wiki.label_tag }} \r
235                                     </span>\r
236                                 </td>\r
237                                 {% endif %}\r
238                             </tr>\r
239                         \r
240                         </table>  \r
241                     </div>\r
242                     {{ answer.text.errors }}\r
243                     <div id="previewer" class="wmd-preview"></div>\r
244                 </div>\r
245 \r
246                     {% if answer.recaptcha %}\r
247                     <div class="question-captcha" style="float: left;">\r
248                         {{ answer.recaptcha.errors }}\r
249                         {{ answer.recaptcha }}\r
250                     </div>\r
251                     <div class="clear"></div>\r
252                     {% endif %}\r
253                 \r
254                 <p><span class="form-error"></span></p>\r
255                 <input type="button"\r
256                     {% if user.is_anonymous %}\r
257                         value="{% trans "Login/Signup to Post Your Answer" %}" \r
258                     {% else %}\r
259                         {% if user == question.author %}\r
260                         value="{% trans "Answer Your Own Question" %}" \r
261                         {% else %}\r
262                         value="{% trans "Answer the question" %}" \r
263                         {% endif %}\r
264                     {% endif %}\r
265                     class="submit" style="float:left" onclick="submitClicked(event, this.form)"/>\r
266             {% endif %}\r
267         </form>\r
268     </div>\r
269 </div>\r
270 {% endblock %}\r
271 \r
272 {% block sidebar %}\r
273 <div class="boxC" id="subscription_box">\r
274     {% include "subscription_status.html" %}\r
275 </div>\r
276 \r
277 {% markdown_help %}\r
278 \r
279 {% sidebar_upper %}\r
280 \r
281 {% cache 60 questions_tags settings.APP_URL question.id %}\r
282 <div class="boxC">\r
283     <p>\r
284                 {% trans "Question tags" %}:\r
285     </p>\r
286     <p class="tags" >\r
287         {% for tag in question.tags.all %}\r
288                 <a href="{% url tag_questions tag.name|urlencode %}"\r
289             class="tag-link-{{ tag.name }}"\r
290                         title="{% trans "see questions tagged"%}'{{tag.name}}'{% trans "using tags" %}"\r
291                         rel="tag">{{ tag.name }}</a> <span class="tag-number">&#215;{{ tag.used_count|intcomma }}</span><br/>\r
292         {% endfor %}\r
293     </p>\r
294     <p>\r
295         {% trans "question asked" %}: <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>\r
296     </p>\r
297     <p> \r
298         {% trans "question was seen" %}: <strong>{{ question.view_count|intcomma }} {% trans "times" %}</strong>\r
299     </p>\r
300     <p> \r
301         {% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</strong>\r
302     </p>\r
303 </div>\r
304 {% endcache %}\r
305 {% sidebar_lower %}\r
306 <div class="boxC">\r
307     <h3 class="subtitle">{% trans "Related questions" %}</h3>\r
308     <div class="questions-related">\r
309 \r
310         {% for question in similar_questions %}\r
311         <p>\r
312             <a href="{{ question.get_absolute_url }}">{{ question.headline }}</a>\r
313         </p>\r
314         {% endfor %}\r
315 \r
316     </div>\r
317 </div>\r
318 \r
319 {% endblock %}\r
320 \r
321 {% block endjs %}\r
322 {% endblock %}\r
323 <!-- end question.html -->\r