summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-10-17 00:31:42 -0300
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2011-10-17 00:31:42 -0300
commit8e1d714137088b4b032d35d6e6a25657bfc7cdfc (patch)
tree199591327a3f6b584c63e25950003bb1a023f1a7
parent49c42b20c234ef22a0c2b681fa109b43c16eab3b (diff)
downloadaskbot-8e1d714137088b4b032d35d6e6a25657bfc7cdfc.tar.gz
askbot-8e1d714137088b4b032d35d6e6a25657bfc7cdfc.tar.bz2
askbot-8e1d714137088b4b032d35d6e6a25657bfc7cdfc.zip
finished splitting question.html
-rw-r--r--askbot/skins/default/templates/macros/macros.html23
-rw-r--r--askbot/skins/default/templates/question.html7
-rw-r--r--askbot/skins/default/templates/question/answer_author_info.html6
-rw-r--r--askbot/skins/default/templates/question/answer_card.html73
-rw-r--r--askbot/skins/default/templates/question/answer_comments.html10
-rw-r--r--askbot/skins/default/templates/question/answer_vote_buttons.html40
-rw-r--r--askbot/skins/default/templates/question/content.html26
-rw-r--r--askbot/skins/default/templates/question/new_answer_form.html57
-rw-r--r--askbot/skins/default/templates/question/new_answer_input.html37
-rw-r--r--askbot/skins/default/templates/question/question_author_info.html6
-rw-r--r--askbot/skins/default/templates/question/question_card.html37
-rw-r--r--askbot/skins/default/templates/question/question_comments.html10
-rw-r--r--askbot/skins/default/templates/question/question_tags.html7
13 files changed, 174 insertions, 165 deletions
diff --git a/askbot/skins/default/templates/macros/macros.html b/askbot/skins/default/templates/macros/macros.html
index 7cae28b3..15b6bf67 100644
--- a/askbot/skins/default/templates/macros/macros.html
+++ b/askbot/skins/default/templates/macros/macros.html
@@ -105,6 +105,25 @@ poor design of the data or methods on data objects #}
{% endif %}
{%- endmacro -%}
+{%- macro post_last_updater_and_creator_info(post, min_rep_to_edit_wiki) -%}
+ {{
+ post_contributor_info(
+ post,
+ "original_author",
+ post.wiki,
+ min_rep_to_edit_wiki
+ )
+ }}
+ {{
+ post_contributor_info(
+ post,
+ "last_updater",
+ post.wiki,
+ min_rep_to_edit_wiki,
+ )
+ }}
+{%- endmacro -%}
+
{%- macro if_else(condition, if_true, if_false) -%}
{%- if condition == True -%}
{{if_true}}
@@ -519,3 +538,7 @@ for the purposes of the AJAX comment editor #}
});
tagAc.decorate($("{{ id }}"));
{%- endmacro -%}
+
+{%- macro answer_classes(answer, question) -%}
+answer {% if answer.accepted %}accepted-answer{% endif %} {% if answer.author_id==question.author_id %} answered-by-owner{% endif %} {% if answer.deleted %}deleted{% endif -%}
+{%- endmacro -%}
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html
index c5434525..7dc85d84 100644
--- a/askbot/skins/default/templates/question.html
+++ b/askbot/skins/default/templates/question.html
@@ -10,13 +10,12 @@
<link rel="stylesheet" type="text/css" href="{{'/js/wmd/wmd.css'|media}}" />
{% endblock %}
{% block content %}
-{%include "question/content.html" %}
+ {%include "question/content.html" %}
{% endblock %}
-
{% block sidebar %}
-{%include "question/sidebar.html" %}
+ {%include "question/sidebar.html" %}
{% endblock %}
{% block endjs %}
-{%include "question/javascript.html" %}
+ {%include "question/javascript.html" %}
{% endblock %}
diff --git a/askbot/skins/default/templates/question/answer_author_info.html b/askbot/skins/default/templates/question/answer_author_info.html
new file mode 100644
index 00000000..f17cb62c
--- /dev/null
+++ b/askbot/skins/default/templates/question/answer_author_info.html
@@ -0,0 +1,6 @@
+{{
+ macros.post_last_updater_and_creator_info(
+ answer,
+ settings.MIN_REP_TO_EDIT_WIKI
+ )
+}}
diff --git a/askbot/skins/default/templates/question/answer_card.html b/askbot/skins/default/templates/question/answer_card.html
index b3790b33..750c9157 100644
--- a/askbot/skins/default/templates/question/answer_card.html
+++ b/askbot/skins/default/templates/question/answer_card.html
@@ -1,49 +1,12 @@
<a name="{{ answer.id }}"></a>
-<div id="answer-container-{{ answer.id }}" class="answer {% if answer.accepted %}accepted-answer{% endif %} {% if answer.author_id==question.author_id %} answered-by-owner{% endif %} {% if answer.deleted %}deleted{% endif %}">
+<div
+ id="answer-container-{{ answer.id }}"
+ class="{{ macros.answer_classes(answer, question) }}">
<table class="answer-table">
<tr>
<td>
<div class="vote-buttons">
- <img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote"
- {% if user_answer_votes[answer.id] == 1 %}
- src="{{'/images/vote-arrow-up-on.png'|media}}"
- {% else %}
- src="{{'/images/vote-arrow-up.png'|media}}"
- {% endif %}
- alt="{% trans %}i like this answer (click again to cancel){% endtrans %}"
- title="{% trans %}i like this answer (click again to cancel){% endtrans %}"/>
- <div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans %}current number of votes{% endtrans %}">
- {{ answer.score }}
- </div>
- <img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote"
- {% if user_answer_votes[answer.id] == -1 %}
- src="{{'/images/vote-arrow-down-on.png'|media}}"
- {% else %}
- src="{{'/images/vote-arrow-down.png'|media}}"
- {% endif %}
- alt="{% trans %}i dont like this answer (click again to cancel){% endtrans %}"
- title="{% trans %}i dont like this answer (click again to cancel){% endtrans %}" />
- {% if request.user == question.author %}
- <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
- {% if answer.accepted %}
- src="{{'/images/vote-accepted-on.png'|media}}"
- {% else %}
- src="{{'/images/vote-accepted.png'|media}}"
- {% endif %}
- alt="{% trans %}mark this answer as favorite (click again to undo){% endtrans %}"
- title="{% trans %}mark this answer as favorite (click again to undo){% endtrans %}" />
- {% else %}
- {% if answer.accepted %}
- <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
- {% if answer.accepted %}
- src="{{'/images/vote-accepted-on.png'|media}}"
- {% else %}
- src="{{'/images/vote-accepted.png'|media}}"
- {% endif %}
- alt="{% trans question_author=question.author.username %}{{question_author}} has selected this answer as correct{% endtrans %}"
- title="{% trans questsion_author=question.author.username%}{{question_author}} has selected this answer as correct{% endtrans %}"
- {% endif %}
- {% endif %}
+ {% include "question/answer_vote_buttons.html" %}
</div>
</td>
<td>
@@ -55,33 +18,9 @@
{% include "widgets/answer_controls.html" %}
</div>
<div class="post-update-info-container">
- {{
- macros.post_contributor_info(
- answer,
- "original_author",
- answer.wiki,
- settings.MIN_REP_TO_EDIT_WIKI
- )
- }}
- {{
- macros.post_contributor_info(
- answer,
- "last_updater",
- answer.wiki,
- settings.MIN_REP_TO_EDIT_WIKI
- )
- }}
+ {% include "question/answer_author_info.html" %}
</div>
- {{
- macros.post_comments_widget(
- post = answer,
- show_post = show_post,
- show_comment = show_comment,
- show_comment_position = show_comment_position,
- user = request.user,
- max_comments = settings.MAX_COMMENTS_TO_SHOW
- )
- }}
+ {% include "question/answer_comments.html" %}
</div>
</td>
</tr>
diff --git a/askbot/skins/default/templates/question/answer_comments.html b/askbot/skins/default/templates/question/answer_comments.html
new file mode 100644
index 00000000..1a1e97fb
--- /dev/null
+++ b/askbot/skins/default/templates/question/answer_comments.html
@@ -0,0 +1,10 @@
+{{
+ macros.post_comments_widget(
+ post = answer,
+ show_post = show_post,
+ show_comment = show_comment,
+ show_comment_position = show_comment_position,
+ user = request.user,
+ max_comments = settings.MAX_COMMENTS_TO_SHOW
+ )
+}}
diff --git a/askbot/skins/default/templates/question/answer_vote_buttons.html b/askbot/skins/default/templates/question/answer_vote_buttons.html
new file mode 100644
index 00000000..bef26b75
--- /dev/null
+++ b/askbot/skins/default/templates/question/answer_vote_buttons.html
@@ -0,0 +1,40 @@
+<img id="answer-img-upvote-{{ answer.id }}" class="answer-img-upvote"
+ {% if user_answer_votes[answer.id] == 1 %}
+ src="{{'/images/vote-arrow-up-on.png'|media}}"
+ {% else %}
+ src="{{'/images/vote-arrow-up.png'|media}}"
+ {% endif %}
+ alt="{% trans %}i like this answer (click again to cancel){% endtrans %}"
+ title="{% trans %}i like this answer (click again to cancel){% endtrans %}"/>
+<div id="answer-vote-number-{{ answer.id }}" class="vote-number" title="{% trans %}current number of votes{% endtrans %}">
+ {{ answer.score }}
+</div>
+<img id="answer-img-downvote-{{ answer.id }}" class="answer-img-downvote"
+ {% if user_answer_votes[answer.id] == -1 %}
+ src="{{'/images/vote-arrow-down-on.png'|media}}"
+ {% else %}
+ src="{{'/images/vote-arrow-down.png'|media}}"
+ {% endif %}
+ alt="{% trans %}i dont like this answer (click again to cancel){% endtrans %}"
+ title="{% trans %}i dont like this answer (click again to cancel){% endtrans %}" />
+{% if request.user == question.author %}
+<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
+ {% if answer.accepted %}
+ src="{{'/images/vote-accepted-on.png'|media}}"
+ {% else %}
+ src="{{'/images/vote-accepted.png'|media}}"
+ {% endif %}
+ alt="{% trans %}mark this answer as favorite (click again to undo){% endtrans %}"
+ title="{% trans %}mark this answer as favorite (click again to undo){% endtrans %}" />
+{% else %}
+ {% if answer.accepted %}
+ <img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept"
+ {% if answer.accepted %}
+ src="{{'/images/vote-accepted-on.png'|media}}"
+ {% else %}
+ src="{{'/images/vote-accepted.png'|media}}"
+ {% endif %}
+ alt="{% trans question_author=question.author.username %}{{question_author}} has selected this answer as correct{% endtrans %}"
+ title="{% trans questsion_author=question.author.username%}{{question_author}} has selected this answer as correct{% endtrans %}"
+ {% endif %}
+{% endif %}
diff --git a/askbot/skins/default/templates/question/content.html b/askbot/skins/default/templates/question/content.html
index 6e16a808..132a9a11 100644
--- a/askbot/skins/default/templates/question/content.html
+++ b/askbot/skins/default/templates/question/content.html
@@ -1,13 +1,11 @@
{% import "macros/macros.html" as macros %}
{% import "macros/utils_macros.html" as utils_macros %}
-<h1><a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a></h1>
{% include "question/question_card.html" %}
{% if question.closed %}
{% include "question/closed_question_info.html" %}
{% endif %}
{% if answers %}
{% include "question/answer_tab_bar.html" %}
-
{{ utils_macros.paginator(paginator_context) }}
{% for answer in answers %}
{% include "question/answer_card.html" %}
@@ -16,27 +14,7 @@
{% else %}
{% include "question/sharing_prompt_phrase.html" %}
{% endif %}
-<form
- id="fmanswer"
- {% if user == question.author %}style="display:none"{% endif %}
- action="{% url answer question.id %}"
- method="post"
->{% csrf_token %}
- {% include "question/subscribe_by_email_prompt.html" %}
- <div style="clear:both"></div>
- {% if request.user.is_anonymous() and settings.ALLOW_POSTING_BEFORE_LOGGING_IN == False %}
- {% if not question.closed %}
- <a
- class="submit"
- href="{{settings.LOGIN_URL}}?next={% url question question.id %}"
- >{% trans %}Login/Signup to Answer{% endtrans %}</a>
- {% endif %}
- {% else %}
- {% if not question.closed %}
- {% include "question/new_answer_input.html" %}
- {% endif %}
- {% endif %}
-</form>
- {% if request.user == question.author %}
+ {% include "question/new_answer_form.html" %}
+ {% if request.user == question.author %}{# this is outside the form on purpose #}
<input type="button" class="submit after-editor" id="fmanswer_button" value="{% trans %}Answer Your Own Question{% endtrans %}"/>
{%endif%}
diff --git a/askbot/skins/default/templates/question/new_answer_form.html b/askbot/skins/default/templates/question/new_answer_form.html
new file mode 100644
index 00000000..49474baa
--- /dev/null
+++ b/askbot/skins/default/templates/question/new_answer_form.html
@@ -0,0 +1,57 @@
+<form
+ id="fmanswer"
+ {% if user == question.author %}style="display:none"{% endif %}
+ action="{% url answer question.id %}"
+ method="post"
+>{% csrf_token %}
+ {% include "question/subscribe_by_email_prompt.html" %}
+ <div style="clear:both"></div>
+ {% if request.user.is_anonymous() and settings.ALLOW_POSTING_BEFORE_LOGGING_IN == False %}
+ {% if not question.closed %}
+ <a
+ class="submit"
+ href="{{settings.LOGIN_URL}}?next={% url question question.id %}"
+ >{% trans %}Login/Signup to Answer{% endtrans %}</a>
+ {% endif %}
+ {% else %}
+ {% if not question.closed %}
+ <div>
+ {% spaceless %}
+ <h2>
+ {% if answers %}
+ {% trans %}Your answer{% endtrans %}
+ {% else %}
+ {% trans %}Be the first one to answer this question!{% endtrans %}
+ {% endif %}
+ </h2>
+ {% endspaceless %}
+ </div>
+ {% if request.user.is_anonymous() %}
+ <div class="message">{% trans %}you can answer anonymously and then login{% endtrans %}</div>
+ {% else %}
+ <p class="message">
+ {% if request.user==question.author %}
+ {% trans %}answer your own question only to give an answer{% endtrans %}
+ {% else %}
+ {% trans %}please only give an answer, no discussions{% endtrans %}
+ {% endif %}
+ </p>
+ {% endif %}
+ {{ macros.edit_post(answer) }}
+ <input type="submit"
+ {% if user.is_anonymous() %}
+ value="{% trans %}Login/Signup to Post Your Answer{% endtrans %}"
+ {% else %}
+ {% if user == question.author %}
+ value="{% trans %}Answer Your Own Question{% endtrans %}"
+ {% else %}
+ value="{% trans %}Answer the question{% endtrans %}"
+ {% endif %}
+ {% endif %}
+ class="submit after-editor" style="float:left"/>
+ {% if settings.WIKI_ON %}
+ {{ macros.checkbox_in_div(answer.wiki) }}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+</form>
diff --git a/askbot/skins/default/templates/question/new_answer_input.html b/askbot/skins/default/templates/question/new_answer_input.html
deleted file mode 100644
index da4be08a..00000000
--- a/askbot/skins/default/templates/question/new_answer_input.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<div>
- {% spaceless %}
- <h2>
- {% if answers %}
- {% trans %}Your answer{% endtrans %}
- {% else %}
- {% trans %}Be the first one to answer this question!{% endtrans %}
- {% endif %}
- </h2>
- {% endspaceless %}
-</div>
-{% if request.user.is_anonymous() %}
- <div class="message">{% trans %}you can answer anonymously and then login{% endtrans %}</div>
-{% else %}
- <p class="message">
- {% if request.user==question.author %}
- {% trans %}answer your own question only to give an answer{% endtrans %}
- {% else %}
- {% trans %}please only give an answer, no discussions{% endtrans %}
- {% endif %}
- </p>
-{% endif %}
-{{ macros.edit_post(answer) }}
-<input type="submit"
- {% if user.is_anonymous() %}
- value="{% trans %}Login/Signup to Post Your Answer{% endtrans %}"
- {% else %}
- {% if user == question.author %}
- value="{% trans %}Answer Your Own Question{% endtrans %}"
- {% else %}
- value="{% trans %}Answer the question{% endtrans %}"
- {% endif %}
- {% endif %}
- class="submit after-editor" style="float:left"/>
-{% if settings.WIKI_ON %}
- {{ macros.checkbox_in_div(answer.wiki) }}
-{% endif %}
diff --git a/askbot/skins/default/templates/question/question_author_info.html b/askbot/skins/default/templates/question/question_author_info.html
new file mode 100644
index 00000000..e43f8931
--- /dev/null
+++ b/askbot/skins/default/templates/question/question_author_info.html
@@ -0,0 +1,6 @@
+{{
+ macros.post_last_updater_and_creator_info(
+ question,
+ settings.MIN_REP_TO_EDIT_WIKI
+ )
+}}
diff --git a/askbot/skins/default/templates/question/question_card.html b/askbot/skins/default/templates/question/question_card.html
index 337c9018..07223f70 100644
--- a/askbot/skins/default/templates/question/question_card.html
+++ b/askbot/skins/default/templates/question/question_card.html
@@ -1,3 +1,4 @@
+<h1><a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a></h1>
<table id="question-table" {% if question.deleted %}class="deleted"{%endif%}>
<tr>
<td>
@@ -10,44 +11,14 @@
<div class="question-body">
{{question.html}}
</div>
- {{ macros.tag_list_widget(
- tags = question.get_tag_names(),
- id = 'question-tags',
- css_class = 'post-tags tags',
- tag_css_class = 'post-tag',
- )
- }}
+ {% include "question/question_tags.html" %}
<div id="question-controls" class="post-controls">
{% include "widgets/question_controls.html" %}
</div>
<div class="post-update-info-container">
- {{
- macros.post_contributor_info(
- question,
- "original_author",
- question.wiki,
- settings.MIN_REP_TO_EDIT_WIKI
- )
- }}
- {{
- macros.post_contributor_info(
- question,
- "last_updater",
- question.wiki,
- settings.MIN_REP_TO_EDIT_WIKI,
- )
- }}
+ {% include "question/question_author_info.html" %}
</div>
- {{
- macros.post_comments_widget(
- post = question,
- show_post = show_post,
- show_comment = show_comment,
- show_comment_position = show_comment_position,
- user = request.user,
- max_comments = settings.MAX_COMMENTS_TO_SHOW
- )
- }}
+ {% include "question/question_comments.html" %}
</td>
</tr>
</table>
diff --git a/askbot/skins/default/templates/question/question_comments.html b/askbot/skins/default/templates/question/question_comments.html
new file mode 100644
index 00000000..36d175a5
--- /dev/null
+++ b/askbot/skins/default/templates/question/question_comments.html
@@ -0,0 +1,10 @@
+{{
+ macros.post_comments_widget(
+ post = question,
+ show_post = show_post,
+ show_comment = show_comment,
+ show_comment_position = show_comment_position,
+ user = request.user,
+ max_comments = settings.MAX_COMMENTS_TO_SHOW
+ )
+}}
diff --git a/askbot/skins/default/templates/question/question_tags.html b/askbot/skins/default/templates/question/question_tags.html
new file mode 100644
index 00000000..d104fe05
--- /dev/null
+++ b/askbot/skins/default/templates/question/question_tags.html
@@ -0,0 +1,7 @@
+{{ macros.tag_list_widget(
+ tags = question.get_tag_names(),
+ id = 'question-tags',
+ css_class = 'post-tags tags',
+ tag_css_class = 'post-tag',
+ )
+}}