diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-10-13 11:59:34 -0300 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-10-13 11:59:34 -0300 |
commit | 969469f29481f15e2e88fbb1e10a7ee53aed99cb (patch) | |
tree | 38fb88843f05ce128d55f17b0cb60633f925896a | |
parent | 3d13cadc0ef3a5a9db9308027a1eb6486d77dc24 (diff) | |
download | askbot-969469f29481f15e2e88fbb1e10a7ee53aed99cb.tar.gz askbot-969469f29481f15e2e88fbb1e10a7ee53aed99cb.tar.bz2 askbot-969469f29481f15e2e88fbb1e10a7ee53aed99cb.zip |
widgets for question page
5 files changed, 108 insertions, 105 deletions
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index 886d256b..0b9be8f8 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -17,47 +17,8 @@ <tr> <td style="width:30px;vertical-align:top"> <div class="vote-buttons"> - {% if question_vote %} - <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote" - {% if question_vote.is_upvote() %} - src="{{'/images/vote-arrow-up-on.png'|media}}" - {% else %} - src="{{'/images/vote-arrow-up.png'|media}}" - {% endif %} - alt="{% trans %}i like this post (click again to cancel){% endtrans %}" - title="{% trans %}i like this post (click again to cancel){% endtrans %}" /> - <div id="question-vote-number-{{ question.id }}" class="vote-number" - title="{% trans %}current number of votes{% endtrans %}"> - {{ question.score }} - </div> - <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote" - {% if question_vote.is_downvote() %} - src="{{'/images/vote-arrow-down-on.png'|media}}" - {% else %} - src="{{'/images/vote-arrow-down.png'|media}}" - {% endif %} - alt="{% trans %}i dont like this post (click again to cancel){% endtrans %}" - title="{% trans %}i dont like this post (click again to cancel){% endtrans %}" /> - {% else %} - <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote" - alt="{% trans %}i like this post (click again to cancel){% endtrans %}" - src="{{'/images/vote-arrow-up.png'|media}}" - title="{% trans %}i like this post (click again to cancel){% endtrans %}" /> - <div id="question-vote-number-{{ question.id }}" class="vote-number" - title="{% trans %}current number of votes{% endtrans %}"> - {{ question.score }} - </div> - <img id="question-img-downvote-{{ question.id }}" class="question-img-downvote" - src="{{'/images/vote-arrow-down.png'|media}}" - alt="{% trans %}i dont like this post (click again to cancel){% endtrans %}" - title="{% trans %}i dont like this post (click again to cancel){% endtrans %}" /> - {% endif %} - - {% if settings.ENABLE_SHARING_TWITTER %}{{ macros.share(site = 'twitter', icon = True) }}{% endif %} - {% if settings.ENABLE_SHARING_FACEBOOK %}{{ macros.share(site = 'facebook', icon = True) }}{% endif %} - {% if settings.ENABLE_SHARING_LINKEDIN %}{{ macros.share(site = 'linkedin', icon = True) }}{% endif %} - {% if settings.ENABLE_SHARING_IDENTICA %}{{ macros.share(site = 'identica', icon = True) }}{% endif %} - {% if settings.ENABLE_SHARING_GOOGLE %}<g:plusone size="small" count="false"></g:plusone>{% endif %} + {% include "widgets/question_vote_buttons.html"%} + {% include "widgets/share_buttons.html"%} </div> </td> <td> @@ -75,37 +36,7 @@ {% endfor %} </ul> <div id="question-controls" class="post-controls"> - {% set pipe=joiner('<span class="sep">|</span>') %} - {% if request.user|can_edit_post(question) %}{{ pipe() }} - <a href="{% url edit_question question.id %}">{% trans %}edit{% endtrans %}</a> - {% endif %} - {% if request.user|can_retag_question(question) %}{{ pipe() }} - <a id="retag" href="{% url retag_question question.id %}">{% trans %}retag{% endtrans %}</a> - <script type="text/javascript"> - var retagUrl = "{% url retag_question question.id %}"; - </script> - {% endif %} - {% if question.closed %} - {% if request.user|can_reopen_question(question) %}{{ pipe() }} - <a href="{% url reopen question.id %}">{% trans %}reopen{% endtrans %}</a> - {% endif %} - {% else %} - {% if request.user|can_close_question(question) %}{{ pipe() }} - <a href="{% url close question.id %}">{% trans %}close{% endtrans %}</a> - {% endif %} - {% endif %} - {% if request.user|can_flag_offensive(question) %}{{ pipe() }} - <span id="question-offensive-flag-{{ question.id }}" class="offensive-flag" - title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}"> - <a>{% trans %}flag offensive{% endtrans %}</a> - {% if request.user|can_see_offensive_flags(question) %} - <span class="darkred">{% if question.offensive_flag_count > 0 %}({{ question.offensive_flag_count }}){% endif %}</span> - {% endif %} - </span> - {% endif %} - {% if request.user|can_delete_post(question) %}{{ pipe() }} - <a id="question-delete-link-{{question.id}}">{% if question.deleted %}{% trans %}undelete{% endtrans %}{% else %}{% trans %}delete{% endtrans %}{% endif %}</a> - {% endif %} + {% include "widgets/question_controls.html" %} </div> <div class="post-update-info-container"> {{ @@ -224,39 +155,7 @@ {{ answer.html }} </div> <div class="answer-controls post-controls"> - {% set pipe=joiner('<span class="sep">|</span>') %} - <span class="linksopt">{{ pipe() }} - <a - href="{{ answer.get_absolute_url() }}" - title="{% trans %}answer permanent link{% endtrans %}"> - {% trans %}permanent link{% endtrans %} - </a> - </span> - {% if request.user|can_edit_post(answer) %}{{ pipe() }} - <span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans %}edit{% endtrans %}</a></span> - {% endif %} - {% if request.user|can_flag_offensive(answer) %}{{ pipe() }} - <span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag" - title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}"> - <a>{% trans %}flag offensive{% endtrans %}</a> - {% if request.user|can_see_offensive_flags(answer) %} - <span class="darkred">{% if answer.offensive_flag_count > 0 %}({{ answer.offensive_flag_count }}){% endif %}</span> - {% endif %} - </span> - {% endif %} - {% if request.user|can_delete_post(answer) %}{{ pipe() }} - {% spaceless %} - <span class="action-link"> - <a id="answer-delete-link-{{answer.id}}"> - {% if answer.deleted %}{% trans %}undelete{% endtrans %}{% else %}{% trans %}delete{% endtrans %}{% endif %}</a> - </span> - {% endspaceless %} - {% endif %} - {% if settings.ALLOW_SWAPPING_QUESTION_WITH_ANSWER and request.user.is_authenticated() and request.user.is_administrator_or_moderator() %}{{ pipe() }} - <span class="action-link"> - <a id="swap-question-with-answer-{{answer.id}}">{% trans %}swap with question{% endtrans %}</a> - </span> - {% endif %} + {% include "widgets/answer_controls.html" %} </div> <div class="post-update-info-container"> {{ diff --git a/askbot/skins/default/templates/widgets/answer_controls.html b/askbot/skins/default/templates/widgets/answer_controls.html new file mode 100644 index 00000000..4309e10c --- /dev/null +++ b/askbot/skins/default/templates/widgets/answer_controls.html @@ -0,0 +1,33 @@ +{% set pipe=joiner('<span class="sep">|</span>') %} +<span class="linksopt">{{ pipe() }} + <a + href="{{ answer.get_absolute_url() }}" + title="{% trans %}answer permanent link{% endtrans %}"> + {% trans %}permanent link{% endtrans %} + </a> +</span> +{% if request.user|can_edit_post(answer) %}{{ pipe() }} +<span class="action-link"><a href="{% url edit_answer answer.id %}">{% trans %}edit{% endtrans %}</a></span> +{% endif %} +{% if request.user|can_flag_offensive(answer) %}{{ pipe() }} +<span id="answer-offensive-flag-{{ answer.id }}" class="offensive-flag" + title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}"> + <a>{% trans %}flag offensive{% endtrans %}</a> + {% if request.user|can_see_offensive_flags(answer) %} + <span class="darkred">{% if answer.offensive_flag_count > 0 %}({{ answer.offensive_flag_count }}){% endif %}</span> + {% endif %} +</span> +{% endif %} +{% if request.user|can_delete_post(answer) %}{{ pipe() }} + {% spaceless %} + <span class="action-link"> + <a id="answer-delete-link-{{answer.id}}"> + {% if answer.deleted %}{% trans %}undelete{% endtrans %}{% else %}{% trans %}delete{% endtrans %}{% endif %}</a> + </span> + {% endspaceless %} +{% endif %} +{% if settings.ALLOW_SWAPPING_QUESTION_WITH_ANSWER and request.user.is_authenticated() and request.user.is_administrator_or_moderator() %}{{ pipe() }} + <span class="action-link"> + <a id="swap-question-with-answer-{{answer.id}}">{% trans %}swap with question{% endtrans %}</a> + </span> +{% endif %} diff --git a/askbot/skins/default/templates/widgets/question_controls.html b/askbot/skins/default/templates/widgets/question_controls.html new file mode 100644 index 00000000..257ce870 --- /dev/null +++ b/askbot/skins/default/templates/widgets/question_controls.html @@ -0,0 +1,31 @@ +{% set pipe=joiner('<span class="sep">|</span>') %} +{% if request.user|can_edit_post(question) %}{{ pipe() }} + <a href="{% url edit_question question.id %}">{% trans %}edit{% endtrans %}</a> +{% endif %} +{% if request.user|can_retag_question(question) %}{{ pipe() }} + <a id="retag" href="{% url retag_question question.id %}">{% trans %}retag{% endtrans %}</a> + <script type="text/javascript"> + var retagUrl = "{% url retag_question question.id %}"; + </script> +{% endif %} +{% if question.closed %} + {% if request.user|can_reopen_question(question) %}{{ pipe() }} + <a href="{% url reopen question.id %}">{% trans %}reopen{% endtrans %}</a> + {% endif %} +{% else %} + {% if request.user|can_close_question(question) %}{{ pipe() }} + <a href="{% url close question.id %}">{% trans %}close{% endtrans %}</a> + {% endif %} +{% endif %} +{% if request.user|can_flag_offensive(question) %}{{ pipe() }} +<span id="question-offensive-flag-{{ question.id }}" class="offensive-flag" + title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}"> + <a>{% trans %}flag offensive{% endtrans %}</a> + {% if request.user|can_see_offensive_flags(question) %} + <span class="darkred">{% if question.offensive_flag_count > 0 %}({{ question.offensive_flag_count }}){% endif %}</span> + {% endif %} +</span> +{% endif %} +{% if request.user|can_delete_post(question) %}{{ pipe() }} + <a id="question-delete-link-{{question.id}}">{% if question.deleted %}{% trans %}undelete{% endtrans %}{% else %}{% trans %}delete{% endtrans %}{% endif %}</a> +{% endif %} diff --git a/askbot/skins/default/templates/widgets/question_vote_buttons.html b/askbot/skins/default/templates/widgets/question_vote_buttons.html new file mode 100644 index 00000000..b3db504f --- /dev/null +++ b/askbot/skins/default/templates/widgets/question_vote_buttons.html @@ -0,0 +1,35 @@ +{% if question_vote %} + <img id="question-img-upvote-{{ question.id }}" class="question-img-upvote" + {% if question_vote.is_upvote() %} + src="{{'/images/vote-arrow-up-on.png'|media}}" + {% else %} + src="{{'/images/vote-arrow-up.png'|media}}" + {% endif %} + alt="{% trans %}i like this post (click again to cancel){% endtrans %}" + title="{% trans %}i like this post (click again to cancel){% endtrans %}" /> +<div id="question-vote-number-{{ question.id }}" class="vote-number" + title="{% trans %}current number of votes{% endtrans %}"> + {{ question.score }} +</div> +<img id="question-img-downvote-{{ question.id }}" class="question-img-downvote" + {% if question_vote.is_downvote() %} + src="{{'/images/vote-arrow-down-on.png'|media}}" + {% else %} + src="{{'/images/vote-arrow-down.png'|media}}" + {% endif %} + alt="{% trans %}i dont like this post (click again to cancel){% endtrans %}" + title="{% trans %}i dont like this post (click again to cancel){% endtrans %}" /> +{% else %} +<img id="question-img-upvote-{{ question.id }}" class="question-img-upvote" + alt="{% trans %}i like this post (click again to cancel){% endtrans %}" + src="{{'/images/vote-arrow-up.png'|media}}" + title="{% trans %}i like this post (click again to cancel){% endtrans %}" /> +<div id="question-vote-number-{{ question.id }}" class="vote-number" + title="{% trans %}current number of votes{% endtrans %}"> + {{ question.score }} +</div> +<img id="question-img-downvote-{{ question.id }}" class="question-img-downvote" + src="{{'/images/vote-arrow-down.png'|media}}" + alt="{% trans %}i dont like this post (click again to cancel){% endtrans %}" + title="{% trans %}i dont like this post (click again to cancel){% endtrans %}" /> +{% endif %} diff --git a/askbot/skins/default/templates/widgets/share_buttons.html b/askbot/skins/default/templates/widgets/share_buttons.html new file mode 100644 index 00000000..5b4fc7ac --- /dev/null +++ b/askbot/skins/default/templates/widgets/share_buttons.html @@ -0,0 +1,5 @@ +{% if settings.ENABLE_SHARING_TWITTER %}{{ macros.share(site = 'twitter', icon = True) }}{% endif %} +{% if settings.ENABLE_SHARING_FACEBOOK %}{{ macros.share(site = 'facebook', icon = True) }}{% endif %} +{% if settings.ENABLE_SHARING_LINKEDIN %}{{ macros.share(site = 'linkedin', icon = True) }}{% endif %} +{% if settings.ENABLE_SHARING_IDENTICA %}{{ macros.share(site = 'identica', icon = True) }}{% endif %} +{% if settings.ENABLE_SHARING_GOOGLE %}<g:plusone size="small" count="false"></g:plusone>{% endif %} |