]> git.openstreetmap.org Git - osqa.git/blob - forum/skins/default/templates/question.html
7a265c6370f318be29cd4e1355458df72a262da5
[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 smart_if %}\r
7 {% load humanize %}\r
8 {% load i18n %}\r
9 {% load cache %}\r
10 {% block title %}{% spaceless %}{{ question.get_question_title }}{% endspaceless %}{% endblock %}\r
11 {% block forejs %}\r
12         <meta name="description" content="{{question.summary}}" />\r
13         <meta name="keywords" content="{{question.tagname_meta_generator}}" />\r
14         <link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />\r
15         {% if not question.closed %}\r
16         <script type='text/javascript' src='{% media  "/media/js/wmd/showdown.js" %}'></script>\r
17         <script type='text/javascript' src='{% media  "/media/js/wmd/wmd.js" %}'></script>\r
18         <link rel="stylesheet" type="text/css" href="{% media  "/media/js/wmd/wmd.css" %}" />\r
19         {% endif %}\r
20 \r
21         <script type="text/javascript">\r
22         // define reputation needs for comments\r
23         var repNeededForComments = 50;\r
24         $().ready(function(){\r
25             $("#nav_questions").attr('className',"on");\r
26             var answer_sort_tab = "{{ tab_id }}";\r
27             $("#" + answer_sort_tab).attr('className',"on");\r
28 \r
29             $('#editor').TextAreaResizer();\r
30         });\r
31         </script>\r
32         <noscript>\r
33             <style>\r
34                 .comment.not_top_scorer {\r
35                     display: block;\r
36                 }\r
37                 .comment-form-container {\r
38                     display: block;\r
39                 }\r
40                 .div.comment-tools {\r
41                     display: none;\r
42                 }\r
43             </style>\r
44         </noscript>\r
45 {% endblock %}\r
46         \r
47 {% block content %}\r
48 <div class="headNormal">\r
49     <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>\r
50 </div>\r
51 <div id="main-body" class="">\r
52     <div id="askform">\r
53             <table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}>\r
54                 <tr>\r
55                     <td style="width:30px;vertical-align:top">\r
56                         <div class="vote-buttons">\r
57                             {% vote_buttons question request.user %}\r
58                             {% favorite_mark question request.user %}                            \r
59                         </div>\r
60                     </td>\r
61                     <td>\r
62                         <div id="item-right">\r
63                             <div class="question-body">\r
64                                 {{ question.html|safe }}\r
65                             </div>\r
66                             <div id="question-controls" class="post-controls">\r
67                                 <div id="question-tags" class="tags">\r
68                                     {% for tag in question.tagname_list %}\r
69                                         <a href="{% url tag_questions tag|urlencode %}" class="post-tag"\r
70                                             title="{% blocktrans with tag as tagname %}see questions tagged '{{ tagname }}'{% endblocktrans %}" rel="tag">{{ tag }}</a>\r
71                                     {% endfor %}\r
72                                 </div>\r
73                                 {% post_controls question request.user %}\r
74                             </div>\r
75                             <div class="post-update-info-container">\r
76                                     {% post_contributor_info question "original_author" %}\r
77                                     {% post_contributor_info question "last_updater" %}\r
78                             </div>\r
79                             {% comments question request.user %}\r
80                         </div>\r
81                         \r
82                     </td>\r
83                 </tr>\r
84             </table>\r
85             {% if question.closed %}\r
86             <div class="question-status" style="margin-bottom:15px">\r
87             <h3>{% blocktrans with question.get_close_reason_display as close_reason %}The question has been closed for the following reason "{{ close_reason }}" by{% endblocktrans %} \r
88             <a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a> \r
89             {% blocktrans with question.closed_at as closed_at %}close date {{closed_at}}{% endblocktrans %}</h3>\r
90             </div>\r
91             {% endif %}\r
92             {% if answers %}\r
93                 <hr/>\r
94                 <div class="tabBar">\r
95                     <a name="sort-top"></a>\r
96                     <div class="headQuestions">\r
97                     {% blocktrans count answers|length as counter %}\r
98                     One Answer:\r
99                     {% plural %}\r
100                     {{counter}} Answers:\r
101                     {% endblocktrans %}\r
102                     </div>\r
103                     <div class="tabsA">\r
104                          <a id="oldest" href="{{ question.get_absolute_url }}?sort=oldest#sort-top"\r
105                             title="{% trans "oldest answers will be shown first" %}">{% trans "oldest answers" %}</a>\r
106                         <a id="latest" href="{{ question.get_absolute_url }}?sort=latest#sort-top"\r
107                             title="{% trans "newest answers will be shown first" %}">{% trans "newest answers" %}</a>\r
108                         <a id="votes" href="{{ question.get_absolute_url }}?sort=votes#sort-top" \r
109                             title="{% trans "most voted answers will be shown first" %}">{% trans "popular answers" %}</a>   \r
110                     </div>\r
111                 </div>\r
112                 {% cnprog_paginator context %}\r
113   \r
114                 {% for answer in answers %}\r
115                     <a name="{{ answer.id }}"></a>\r
116                     <div id="answer-container-{{ answer.id }}" class="answer {% if answer.accepted %}accepted-answer{% endif %} {% ifequal answer.author_id question.author_id %} answered-by-owner{% endifequal %} {% if answer.deleted %}deleted{% endif %}">\r
117                         <table style="width:100%;">\r
118                             <tr>\r
119                                 <td style="width:30px;vertical-align:top">\r
120                                     <div class="vote-buttons">\r
121                                         {% vote_buttons answer request.user %}\r
122                                         {% accept_button answer request.user %}\r
123                                     </div>\r
124                                 </td>\r
125                                 <td>\r
126                                     <div class="item-right">\r
127                                         <div class="answer-body">\r
128                                             {{ answer.html|safe }}\r
129                                         </div>\r
130                                         <div class="answer-controls post-controls">\r
131                                             {% post_controls answer request.user %}\r
132                                         </div>\r
133                                         <div class="post-update-info-container">\r
134                                                 {% post_contributor_info answer "original_author" %}\r
135                                                 {% post_contributor_info answer "last_updater" %}\r
136                                         </div>\r
137                                         {% comments answer request.user %}\r
138                                     </div>\r
139                                 </td>\r
140                             </tr>\r
141                         </table>\r
142                     </div>\r
143                 {% endfor %}\r
144                 <div class="paginator-container-left">\r
145                     {% cnprog_paginator context %}\r
146                 </div>\r
147             {% endif %}\r
148         <form id="fmanswer" action="{% url answer question.id %}" method="post">\r
149             <div style="clear:both">\r
150             </div>\r
151             \r
152             {% if not question.closed %}\r
153                 <div style="padding:10px 0 0 0;">\r
154                     {% spaceless %}\r
155                     <div class="headNormal">\r
156                         {% if answers %}\r
157                             {% trans "Your answer" %}\r
158                         {% else %}\r
159                             {% trans "Be the first one to answer this question!" %}\r
160                         {% endif %}\r
161                     </div>\r
162                     {% endspaceless %}\r
163                 </div>\r
164                 {% if not request.user.is_authenticated %}\r
165                     <div class="message">{% trans "you can answer anonymously and then login" %}</div>\r
166                 {% else %}\r
167                     <p class="message">\r
168                         {% ifequal request.user question.author  %}\r
169                             {% trans "answer your own question only to give an answer" %}\r
170                         {% else %}\r
171                             {% trans "please only give an answer, no discussions" %}\r
172                         {% endifequal %}\r
173                     </p>\r
174                 {% endif %}\r
175 \r
176                 <div id="description" class="" >\r
177                     <div id="wmd-button-bar" class="wmd-panel"></div>\r
178                     {{ answer.text }}\r
179                     <div class="preview-toggle">\r
180                         <table width="100%">\r
181                             <tr>\r
182                                 <td>\r
183                                     <span id="pre-collapse" \r
184                                         title="{% trans "Toggle the real time Markdown editor preview" %}">\r
185                                             {% trans "toggle preview" %}\r
186                                     </span>\r
187                                 </td>\r
188                                 {% if settings.WIKI_ON %}\r
189                                 <td style="text-align:right;">\r
190                                     {{ answer.wiki }} \r
191                                     <span style="font-weight:normal;cursor:help" \r
192                                         title="{{answer.wiki.help_text}}">\r
193                                             {{ answer.wiki.label_tag }} \r
194                                     </span>\r
195                                 </td>\r
196                                 {% endif %}\r
197                             </tr>\r
198                         \r
199                         </table>  \r
200                     </div>\r
201                     <div id="previewer" class="wmd-preview"></div>\r
202                     {{ answer.text.errors }}\r
203                 </div>\r
204                 <p><span class="form-error"></span></p>\r
205                 <input type="submit" \r
206                     {% if user.is_anonymous %}\r
207                         value="{% trans "Login/Signup to Post Your Answer" %}" \r
208                     {% else %}\r
209                         {% if user == question.author %}\r
210                         value="{% trans "Answer Your Own Question" %}" \r
211                         {% else %}\r
212                         value="{% trans "Answer the question" %}" \r
213                         {% endif %}\r
214                     {% endif %}\r
215                     class="submit" style="float:left"/>\r
216             {% endif %}\r
217         </form>\r
218     </div>\r
219 </div>\r
220 {% endblock %}\r
221 \r
222 {% block sidebar %}\r
223 <div class="boxC" id="subscription_box">\r
224     {% include "subscription_status.html" %}\r
225 </div>\r
226 {% cache 60 questions_tags settings.APP_URL question.id %}\r
227 <div class="boxC">\r
228     <p>\r
229                 {% trans "Question tags" %}:\r
230     </p>\r
231     <p class="tags" >\r
232         {% for tag in tags %}\r
233                 <a href="{% url tag_questions tag.name|urlencode %}" \r
234                         title="{% trans "see questions tagged"%}'{{tag.name}}'{% trans "using tags" %}" \r
235                         rel="tag">{{ tag.name }}</a> <span class="tag-number">&#215;{{ tag.used_count|intcomma }}</span><br/>\r
236         {% endfor %}\r
237     </p>\r
238     <p>\r
239         {% trans "question asked" %}: <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>\r
240     </p>\r
241     <p> \r
242         {% trans "question was seen" %}: <strong>{{ question.view_count|intcomma }} {% trans "times" %}</strong>\r
243     </p>\r
244     <p> \r
245         {% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</strong>\r
246     </p>\r
247 </div>\r
248 {% endcache %}\r
249 <div class="boxC">\r
250     <h3 class="subtitle">{% trans "Related questions" %}</h3>\r
251     <div class="questions-related">\r
252 \r
253         {% for question in similar_questions %}\r
254         <p>\r
255             <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>\r
256         </p>\r
257         {% endfor %}\r
258 \r
259     </div>\r
260 </div>\r
261 \r
262 {% endblock %}\r
263 \r
264 {% block endjs %}\r
265 {% endblock %}\r
266 <!-- end question.html -->\r