1 {% extends "base.html" %}
\r
2 <!-- question.html -->
\r
3 {% load extra_tags %}
\r
4 {% load extra_filters %}
\r
8 {% block title %}{% spaceless %}{{ question.get_question_title }}{% endspaceless %}{% endblock %}
\r
10 <meta name="description" content="{{question.summary}}" />
\r
11 <meta name="keywords" content="{{question.tagname_meta_generator}}" />
\r
12 <link rel="canonical" href="{{settings.APP_URL}}{{question.get_absolute_url}}" />
\r
13 {% if not question.closed %}
\r
14 <script type='text/javascript' src='{% media "/media/js/com.cnprog.editor.js" %}'></script>
\r
15 <script type='text/javascript' src='{% media "/media/js/wmd/showdown.js" %}'></script>
\r
16 <script type='text/javascript' src='{% media "/media/js/wmd/wmd.js" %}'></script>
\r
17 <link rel="stylesheet" type="text/css" href="{% media "/media/js/wmd/wmd.css" %}" />
\r
19 <script type='text/javascript' src='{% media "/media/js/com.cnprog.post.js" %}'></script>
\r
20 <script type='text/javascript' src='{% media "/media/js/jquery.validate.pack.js" %}'></script>
\r
22 <script type="text/javascript">
\r
23 // define reputation needs for comments
\r
24 var repNeededForComments = 50;
\r
25 $().ready(function(){
\r
26 $("#nav_questions").attr('className',"on");
\r
27 var answer_sort_tab = "{{ tab_id }}";
\r
28 $("#" + answer_sort_tab).attr('className',"on");
\r
30 Vote.init({{ question.id }}, '{{ question.title|slugify }}', '{{ question.author.id }}','{{ request.user.id }}');
\r
32 {% if not question.closed and request.user.is_authenticated %}initEditor();{% endif %}
\r
34 lanai.highlightSyntax();
\r
35 $('#btLogin').bind('click', function(){window.location.href='{% url auth_signin %}'; } )
\r
38 function initEditor(){
\r
39 $('#editor').TextAreaResizer();
\r
40 //highlight code synctax when editor has new text
\r
41 $("#editor").typeWatch({highlight: false, wait: 3000,
\r
42 captureLength: 5, callback: lanai.highlightSyntax});
\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
50 $('#previewer').toggle();
\r
51 $('#pre-collapse').text(txt);
\r
54 setupFormValidation("#fmanswer", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
\r
61 <div class="headNormal">
\r
62 <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
\r
64 <div id="main-body" class="">
\r
66 <table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}>
\r
68 <td style="width:30px;vertical-align:top">
\r
69 <div class="vote-buttons">
\r
70 {% if question_vote %}
\r
71 <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
\r
72 {% if question_vote.is_upvote %}
\r
73 src="{% media "/media/images/vote-arrow-up-on.png" %}"
\r
75 src="{% media "/media/images/vote-arrow-up.png" %}"
\r
77 alt="{% trans "i like this post (click again to cancel)" %}"
\r
78 title="{% trans "i like this post (click again to cancel)" %}" />
\r
79 <div id="question-vote-number-{{ question.id }}" class="vote-number"
\r
80 title="{% trans "current number of votes" %}">
\r
81 {{ question.score }}
\r
83 <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
\r
84 {% if question_vote.is_downvote %}
\r
85 src="{% media "/media/images/vote-arrow-down-on.png" %}"
\r
87 src="{% media "/media/images/vote-arrow-down.png" %}"
\r
89 alt="{% trans "i dont like this post (click again to cancel)" %}"
\r
90 title="{% trans "i dont like this post (click again to cancel)" %}" />
\r
93 <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote"
\r
94 alt="{% trans "i like this post (click again to cancel)" %}"
\r
95 src="{% media "/media/images/vote-arrow-up.png" %}"
\r
96 title="{% trans "i like this post (click again to cancel)" %}" />
\r
97 <div id="question-vote-number-{{ question.id }}" class="vote-number"
\r
98 title="{% trans "current number of votes" %}">
\r
99 {{ question.score }}
\r
101 <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote"
\r
102 src="{% media "/media/images/vote-arrow-down.png" %}"
\r
103 alt="{% trans "i dont like this post (click again to cancel)" %}"
\r
104 title="{% trans "i dont like this post (click again to cancel)" %}" />
\r
107 <img class="question-img-favorite" src="{% media "/media/images/vote-favorite-on.png" %}"
\r
108 alt="{% trans "mark this question as favorite (click again to cancel)" %}"
\r
109 title="{% trans "mark this question as favorite (click again to cancel)" %}" />
\r
110 <div id="favorite-number" class="favorite-number my-favorite-number">
\r
111 {{ question.favourite_count }}
\r
114 <img class="question-img-favorite" src="{% media "/media/images/vote-favorite-off.png" %}"
\r
115 alt="{% trans "remove favorite mark from this question (click again to restore mark)" %}"
\r
116 title="{% trans "remove favorite mark from this question (click again to restore mark)" %}" />
\r
117 <div id="favorite-number" class="favorite-number">
\r
118 {% ifnotequal question.favourite_count 0 %}{{ question.favourite_count }}{% endifnotequal %}
\r
125 <div id="item-right">
\r
126 <div class="question-body">
\r
127 {{ question.html|safe }}
\r
129 <div id="question-controls" class="post-controls">
\r
130 <div id="question-tags" class="tags">
\r
131 {% for tag in question.tagname_list %}
\r
132 <a href="{% url tag_questions tag|urlencode %}" class="post-tag"
\r
133 title="{% blocktrans with tag as tagname %}see questions tagged '{{ tagname }}'{% endblocktrans %}" rel="tag">{{ tag }}</a>
\r
136 {% joinitems using '<span class="action-link-separator">|</span>' %}
\r
137 {% if request.user|can_edit_post:question %}
\r
138 <span class="action-link"><a href="{% url edit_question question.id %}">{% trans 'edit' %}</a></span>
\r
141 {% if question.closed %}
\r
142 {% if request.user|can_reopen_question:question %}
\r
143 <span class="action-link"><a href="{% url reopen question.id %}">{% trans "reopen" %}</a></span>
\r
146 {% if request.user|can_close_question:question %}
\r
147 <span class="action-link"><a href="{% url close question.id %}">{% trans "close" %}</a></span>
\r
151 {% if request.user|can_flag_offensive %}
\r
152 <span id="question-offensive-flag-{{ question.id }}" class="offensive-flag"
\r
153 title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
\r
154 <a>{% trans "flag offensive" %}</a>
\r
155 {% if request.user|can_view_offensive_flags and question.offensive_flag_count %}
\r
156 <span class="darkred">({{ question.offensive_flag_count }})</span>
\r
161 {% if request.user|can_delete_post:question %}
\r
162 <span class="action-link"><a id="question-delete-link-{{question.id}}">{% trans "delete" %}</a></span>
\r
166 <div class="post-update-info-container">
\r
167 {% post_contributor_info question "original_author" %}
\r
168 {% post_contributor_info question "last_updater" %}
\r
170 <div class="comments-container" id="comments-container-question-{{question.id}}">
\r
171 {% for comment in question.get_comments|slice:":5" %}
\r
172 <p class="comment" id="comment-{{comment.id}}">
\r
173 {{comment.comment}}
\r
174 - <a class="comment-user" href="{{comment.user.get_profile_url}}">{{comment.user}}</a>
\r
176 <span class="comment-age">({% diff_date comment.added_at %})</span>
\r
177 {% if request.user|can_delete_comment:comment %}
\r
178 <img class="delete-icon"
\r
179 src="{% media "/media/images/close-small.png" %}"
\r
180 title="{% trans "delete this comment" %}"/>
\r
186 <div class="post-comments" style="margin-bottom:20px">
\r
187 <input id="can-post-comments-question-{{question.id}}" type="hidden" value="{{ request.user|can_add_comments:question }}"/>
\r
188 {% if request.user|can_add_comments:question or question.comment_count > 5 %}
\r
189 <a id="comments-link-question-{{question.id}}" class="comments-link">
\r
190 {% if request.user|can_add_comments:question %}
\r
191 {% trans "add comment" %}
\r
193 {% if question.comment_count > 5 %}
\r
194 {% if request.user|can_add_comments:question %}/
\r
195 {% blocktrans count question.get_comments|slice:"5:"|length as counter %}
\r
196 see <strong>one</strong> more
\r
198 see <strong>{{counter}}</strong> more
\r
199 {% endblocktrans %}
\r
201 {% blocktrans count question.get_comments|slice:"5:"|length as counter %}
\r
202 see <strong>one</strong> more comment
\r
204 see <strong>{{counter}}</strong> more comments
\r
205 {% endblocktrans %}
\r
215 {% if question.closed %}
\r
216 <div class="question-status" style="margin-bottom:15px">
\r
217 <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
218 <a href="{{ question.closed_by.get_profile_url }}">{{ question.closed_by.username }}</a>
\r
219 {% blocktrans with question.closed_at as closed_at %}close date {{closed_at}}{% endblocktrans %}</h3>
\r
224 <div class="tabBar">
\r
225 <a name="sort-top"></a>
\r
226 <div class="headQuestions">
\r
227 {% blocktrans count answers|length as counter %}
\r
230 {{counter}} Answers:
\r
231 {% endblocktrans %}
\r
233 <div class="tabsA">
\r
234 <a id="oldest" href="{% url question question.id %}?sort=oldest#sort-top"
\r
235 title="{% trans "oldest answers will be shown first" %}">{% trans "oldest answers" %}</a>
\r
236 <a id="latest" href="{% url question question.id %}?sort=latest#sort-top"
\r
237 title="{% trans "newest answers will be shown first" %}">{% trans "newest answers" %}</a>
\r
238 <a id="votes" href="{% url question question.id %}?sort=votes#sort-top"
\r
239 title="{% trans "most voted answers will be shown first" %}">{% trans "popular answers" %}</a>
\r
242 {% cnprog_paginator context %}
\r
244 {% for answer in answers %}
\r
245 <a name="{{ answer.id }}"></a>
\r
246 <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
247 <table style="width:100%;">
\r
249 <td style="width:30px;vertical-align:top">
\r
250 <div class="vote-buttons">
\r
251 <img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote"
\r
252 src="{% blockmedia %}/media/images/vote-arrow-up{% get_user_vote_image user_answer_votes answer.id 1 %}.png{% endblockmedia %}"
\r
253 alt="{% trans "i like this answer (click again to cancel)" %}"
\r
254 title="{% trans "i like this answer (click again to cancel)" %}"/>
\r
255 <div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans "current number of votes" %}">
\r
258 <img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote"
\r
259 src="{% blockmedia %}/media/images/vote-arrow-down{% get_user_vote_image user_answer_votes answer.id -1 %}.png{% endblockmedia %}"
\r
260 alt="{% trans "i dont like this answer (click again to cancel)" %}"
\r
261 title="{% trans "i dont like this answer (click again to cancel)" %}" />
\r
263 {% ifequal request.user question.author %}
\r
264 <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
\r
265 src="{% blockmedia %}/media/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png{% endblockmedia %}"
\r
266 alt="{% trans "mark this answer as favorite (click again to undo)" %}"
\r
267 title="{% trans "mark this answer as favorite (click again to undo)" %}" />
\r
269 {% if answer.accepted %}
\r
270 <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
\r
271 src="{% blockmedia %}/media/images/vote-accepted{% if answer.accepted %}-on{% endif %}.png{% endblockmedia %}"
\r
272 alt="{% trans "the author of the question has selected this answer as correct" %}"
\r
273 title="{% trans "the author of the question has selected this answer as correct" %}" />
\r
279 <div class="item-right">
\r
280 <div class="answer-body">
\r
281 {{ answer.html|safe }}
\r
283 <div class="answer-controls post-controls">
\r
284 {% joinitems using '<span class="action-link-separator">|</span>' %}
\r
285 <span class="linksopt">
\r
286 <a href="#{{ answer.id }}" title="{% trans "answer permanent link" %}">
\r
287 {% trans "permanent link" %}
\r
291 {% if request.user|can_edit_post:answer %}
\r
292 <span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans 'edit' %}</a></span>
\r
295 {% if request.user|can_flag_offensive %}
\r
296 <span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag"
\r
297 title="{% trans "report as offensive (i.e containing spam, advertising, malicious text, etc.)" %}">
\r
298 <a>{% trans "flag offensive" %}</a>
\r
299 {% if request.user|can_view_offensive_flags and answer.offensive_flag_count %}
\r
300 <span class="darkred">({{ answer.offensive_flag_count }})</span>
\r
305 {% if request.user|can_delete_post:answer %}
\r
307 <span class="action-link">
\r
308 <a id="answer-delete-link-{{answer.id}}">
\r
309 {% if answer.deleted %}{% trans "undelete" %}{% else %}{% trans "delete" %}{% endif %}</a>
\r
315 <div class="post-update-info-container">
\r
316 {% post_contributor_info answer "original_author" %}
\r
317 {% post_contributor_info answer "last_updater" %}
\r
319 <div class="comments-container" id="comments-container-answer-{{answer.id}}">
\r
320 {% for comment in answer.get_comments|slice:":5" %}
\r
321 <p id="comment-{{comment.id}}" class="comment">
\r
322 {{comment.comment}}
\r
323 - <a class="comment-user" href="{{comment.user.get_profile_url}}">{{comment.user}}</a>
\r
325 <span class="comment-age">({% diff_date comment.added_at %})</span>
\r
326 {% if request.user|can_delete_comment:comment %}
\r
327 <img class="delete-icon"
\r
328 src="{% media "/media/images/close-small.png" %}"
\r
329 title="{% trans "delete this comment" %}"/>
\r
335 <div class="post-comments" style="margin-bottom:20px">
\r
336 <input id="can-post-comments-answer-{{answer.id}}" type="hidden" value="{{ request.user|can_add_comments:answer}}"/>
\r
337 {% if request.user|can_add_comments:answer or answer.comment_count > 5 %}
\r
338 <a id="comments-link-answer-{{answer.id}}" class="comments-link">
\r
339 {% if request.user|can_add_comments:answer %}
\r
340 {% trans "add comment" %}
\r
342 {% if answer.comment_count > 5 %}
\r
343 {% if request.user|can_add_comments:answer %}/
\r
344 {% blocktrans count answer.get_comments|slice:"5:"|length as counter %}
\r
345 see <strong>one</strong> more
\r
347 see <strong>{{counter}}</strong> more
\r
348 {% endblocktrans %}
\r
350 {% blocktrans count answer.get_comments|slice:"5:"|length as counter %}
\r
351 see <strong>one</strong> more comment
\r
353 see <strong>{{counter}}</strong> more comments
\r
354 {% endblocktrans %}
\r
366 <div class="paginator-container-left">
\r
367 {% cnprog_paginator context %}
\r
370 <form id="fmanswer" action="{% url answer question.id %}" method="post">
\r
371 {% if request.user.is_authenticated %}
\r
372 <p style="padding-left:3px">
\r
373 {{ answer.email_notify }}
\r
374 <label for="question-subscribe-updates">
\r
375 {% ifequal request.user.get_q_sel_email_feed_frequency 'n' %}
\r
376 {% trans "Notify me once a day when there are any new answers" %}
\r
378 {% ifequal request.user.get_q_sel_email_feed_frequency 'd' %}
\r
379 {% trans "Notify me once a day when there are any new answers" %}
\r
381 {% ifequal request.user.get_q_sel_email_feed_frequency 'w' %}
\r
382 {% trans "Notify me weekly when there are any new answers" %}
\r
387 {% blocktrans with request.user.get_profile_url as profile_url %}
\r
388 You can always adjust frequency of email updates from your {{profile_url}}
\r
389 {% endblocktrans %}
\r
392 <p style="padding-left:3px">
\r
393 <input class="nomargin" type="checkbox" disabled="disabled" />
\r
394 <label>{% trans "once you sign in you will be able to subscribe for any updates here" %}</label>
\r
397 <div style="clear:both">
\r
400 {% if not question.closed %}
\r
401 <div style="padding:10px 0 0 0;">
\r
403 <div class="headNormal">
\r
405 {% trans "Your answer" %}
\r
407 {% trans "Be the first one to answer this question!" %}
\r
412 {% if not request.user.is_authenticated %}
\r
413 <div class="message">{% trans "you can answer anonymously and then login" %}</div>
\r
415 <p class="message">
\r
416 {% ifequal request.user question.author %}
\r
417 {% trans "answer your own question only to give an answer" %}
\r
419 {% trans "please only give an answer, no discussions" %}
\r
424 <div id="description" class="" >
\r
425 <div id="wmd-button-bar" class="wmd-panel"></div>
\r
427 <div class="preview-toggle">
\r
428 <table width="100%">
\r
431 <span id="pre-collapse"
\r
432 title="{% trans "Toggle the real time Markdown editor preview" %}">
\r
433 {% trans "toggle preview" %}
\r
436 {% if settings.WIKI_ON %}
\r
437 <td style="text-align:right;">
\r
439 <span style="font-weight:normal;cursor:help"
\r
440 title="{{answer.wiki.help_text}}">
\r
441 {{ answer.wiki.label_tag }}
\r
449 <div id="previewer" class="wmd-preview"></div>
\r
450 {{ answer.text.errors }}
\r
452 <p><span class="form-error"></span></p>
\r
453 <input type="submit"
\r
454 {% if user.is_anonymous %}
\r
455 value="{% trans "Login/Signup to Post Your Answer" %}"
\r
457 {% if user == question.author %}
\r
458 value="{% trans "Answer Your Own Question" %}"
\r
460 value="{% trans "Answer the question" %}"
\r
463 class="submit" style="float:left"/>
\r
470 {% block sidebar %}
\r
473 {% trans "Question tags" %}:
\r
476 {% for tag in tags %}
\r
477 <a href="{% url tag_questions tag.name|urlencode %}"
\r
478 title="{% trans "see questions tagged"%}'{{tag.name}}'{% trans "using tags" %}"
\r
479 rel="tag">{{ tag.name }}</a> <span class="tag-number">×{{ tag.used_count|intcomma }}</span><br/>
\r
483 {% trans "question asked" %}: <strong title="{{ question.added_at }}">{% diff_date question.added_at %}</strong>
\r
486 {% trans "question was seen" %}: <strong>{{ question.view_count|intcomma }} {% trans "times" %}</strong>
\r
489 {% trans "last updated" %}: <strong title="{{ question.last_activity_at }}">{% diff_date question.last_activity_at %}</strong>
\r
494 <h3 class="subtitle">{% trans "Related questions" %}</h3>
\r
495 <div class="questions-related">
\r
496 {% for question in similar_questions %}
\r
498 <a href="{{ question.get_absolute_url }}">{{ question.get_question_title }}</a>
\r
508 <!-- end question.html -->
\r