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