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