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