diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-10-14 12:39:11 -0300 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-10-14 12:39:11 -0300 |
commit | c63445a76b43c5152df1366ae184c2f4ae89c3bf (patch) | |
tree | de907ab391e41862666ee0abdd5b1964a5ef1fbb | |
parent | 99721376794993406090f8f383b38793129b46c7 (diff) | |
download | askbot-c63445a76b43c5152df1366ae184c2f4ae89c3bf.tar.gz askbot-c63445a76b43c5152df1366ae184c2f4ae89c3bf.tar.bz2 askbot-c63445a76b43c5152df1366ae184c2f4ae89c3bf.zip |
splited question.html
-rw-r--r-- | askbot/skins/default/templates/question.html | 474 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/content.html | 279 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/javascript.html | 95 | ||||
-rw-r--r-- | askbot/skins/default/templates/question/sidebar.html | 98 |
4 files changed, 476 insertions, 470 deletions
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index 0b9be8f8..c5434525 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -1,6 +1,4 @@ {% extends "two_column_body.html" %} -{% import "macros/macros.html" as macros %} -{% import "macros/utils_macros.html" as utils_macros %} <!-- question.html --> {% block title %}{% spaceless %}{{ question.get_question_title() }}{% endspaceless %}{% endblock %} {% block meta_description %} @@ -12,477 +10,13 @@ <link rel="stylesheet" type="text/css" href="{{'/js/wmd/wmd.css'|media}}" /> {% endblock %} {% block content %} -<h1><a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a></h1> -<table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}> - <tr> - <td style="width:30px;vertical-align:top"> - <div class="vote-buttons"> - {% include "widgets/question_vote_buttons.html"%} - {% include "widgets/share_buttons.html"%} - </div> - </td> - <td> - <div class="question-body"> - {{question.html}} - </div> - <ul id="question-tags" class="post-tags tags"> - {% for tag in question.get_tag_names() %} - {{ macros.tag_widget( - tag, - css_class = 'post-tag', - html_tag = 'li' - ) - }} - {% endfor %} - </ul> - <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, - ) - }} - </div> - {{ - macros.post_comments_widget( - post = question, - show_post = show_post, - show_comment = show_comment, - comment_order_number = comment_order_number, - user = request.user, - max_comments = settings.MAX_COMMENTS_TO_SHOW - ) - }} - <!--/div--> - </td> - </tr> -</table> -{% if question.closed %} -<div class="question-status" style="margin-bottom:15px"> -<h3>{% trans close_reason=question.get_close_reason_display() %}The question has been closed for the following reason "{{ close_reason }}" by{% endtrans %} -<a href="{{ question.closed_by.get_profile_url() }}">{{ question.closed_by.username }}</a> -{% trans closed_at=question.closed_at %}close date {{closed_at}}{% endtrans %}</h3> -</div> -{% endif %} -{% if answers %} - <div class="tabBar"> - <h2 id="sort-top"> - {% trans counter=answers|length %} - {{counter}} Answer: - {% pluralize %} - {{counter}} Answers: - {% endtrans %} - </h2> - <div class="tabsA"> - <a id="oldest" href="{{ question.get_absolute_url() }}?sort=oldest#sort-top" - title="{% trans %}oldest answers will be shown first{% endtrans %}" - ><span>{% trans %}oldest answers{% endtrans %}</span></a> - <a id="latest" href="{{ question.get_absolute_url() }}?sort=latest#sort-top" - title="{% trans %}newest answers will be shown first{% endtrans %}" - ><span>{% trans %}newest answers{% endtrans %}</span></a> - <a id="votes" href="{{ question.get_absolute_url() }}?sort=votes#sort-top" - title="{% trans %}most voted answers will be shown first{% endtrans %}" - ><span>{% trans %}popular answers{% endtrans %}</span></a> - </div> - </div> - {{ utils_macros.paginator(paginator_context) }} - - {% for answer in answers %} - <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 %}"> - <table style="width:100%;" class="answer-table"> - <tr> - <td style="width:30px;vertical-align:top"> - <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 %} - </div> - </td> - <td> - <div class="item-right"> - <div class="answer-body"> - {{ answer.html }} - </div> - <div class="answer-controls post-controls"> - {% 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 - ) - }} - </div> - {{ - macros.post_comments_widget( - post = answer, - show_post = show_post, - show_comment = show_comment, - comment_order_number = comment_order_number, - user = request.user, - max_comments = settings.MAX_COMMENTS_TO_SHOW - ) - }} - </div> - </td> - </tr> - </table> - </div> - {% endfor %} - {{ utils_macros.paginator(paginator_context) }} -{% else %} - {% set question_url=settings.APP_URL+question.get_absolute_url()|urlencode %} - <h2 class="share-question">{% trans %}Know someone who can answer? Share a <a href="{{ question_url }}">link</a> to this question via{% endtrans %} - {% if settings.ENABLE_SHARING_TWITTER %}{{ macros.share(site = 'twitter', site_label = 'Twitter') }},{% endif %} - {% if settings.ENABLE_SHARING_FACEBOOK %}{{ macros.share(site = 'facebook', site_label = 'Facebook') }},{% endif %} - {% if settings.ENABLE_SHARING_LINKEDIN %}{{ macros.share(site = 'linkedin', site_label = 'LinkedIn') }},{% endif %} - {% if settings.ENABLE_SHARING_IDENTICA %}{{ macros.share(site = 'identica', site_label = 'Identi.ca') }},{% endif %} - {%- if settings.ENABLE_SHARING_TWITTER or settings.ENABLE_SHARING_FACEBOOK or settings.ENABLE_SHARING_LINKEDIN or settings.ENABLE_SHARING_IDENTICA -%} - {% trans %} or{% endtrans %} - {% endif %} - <a href="mailto:?subject={{ settings.APP_SHORT_NAME|urlencode }}&body={{ question_url }}">{% trans %}email{% endtrans %}</a>. - </h2> -{% endif %} -<form - id="fmanswer" - {% if user == question.author %}style="display:none"{% endif %} - action="{% url answer question.id %}" - method="post" ->{% csrf_token %} - {% if request.user.is_authenticated() %} - <p style="padding-left:3px"> - {{ answer.email_notify }} - <label for="question-subscribe-updates"> - {% set email_feed_frequency = request.user.get_followed_question_alert_frequency() %} - {% if email_feed_frequency =='n' %} - {% trans %}Notify me once a day when there are any new answers{% endtrans %} - {% elif email_feed_frequency =='d' %} - {% trans %}Notify me once a day when there are any new answers{% endtrans %} - {% elif email_feed_frequency =='w' %} - {% trans %}Notify me weekly when there are any new answers{% endtrans %} - {% elif email_feed_frequency =='i' %} - {% trans %}Notify me immediately when there are any new answers{% endtrans %} - {% endif %} - </label> - {% trans profile_url=request.user.get_profile_url() %}You can always adjust frequency of email updates from your {{profile_url}}{% endtrans %} - </p> - {% else %} - <p style="padding-left:3px"> - {{ answer.email_notify }} - <label>{% trans %}once you sign in you will be able to subscribe for any updates here{% endtrans %}</label> - </p> - {% endif %} - <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 style="padding:10px 0 0 0;"> - {% 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> - {% if request.user == question.author %} - <input type="button" class="submit after-editor" id="fmanswer_button" value="{% trans %}Answer Your Own Question{% endtrans %}"/> - {%endif%} +{%include "question/content.html" %} {% endblock %} {% block sidebar %} - -{{ settings.SIDEBAR_QUESTION_HEADER }} -<div class="boxC vote-buttons"> - <h2 style="font-size: 22px;margin-top: 11px; text-align: left;">{% trans %}Question tools{% endtrans %}</h2> - {% if favorited %} - <a class="button followed" - alt="{% trans %}click to unfollow this question{% endtrans %}"> - <div>{% trans %}Following{% endtrans %}</div> - <div class='unfollow'>{% trans %}Unfollow{% endtrans %}</div> - </a> - {% else %} - <a class="button follow" - alt="{% trans %}click to follow this question{% endtrans %}"> - {%trans %}Follow{%endtrans%} - </a> - {% endif %} - <div class="clearfix"></div> - <div id="favorite-number" class="favorite-number{% if favorited %} my-favorite-number{% endif %}"> - {% set follower_count = question.favourite_count %} - {% if follower_count > 0 %} - {% trans count=follower_count %}{{count}} follower{% pluralize %}{{count}} followers{% endtrans %} - {% endif %} - </div> - <div class="notify-sidebar"> - {%if request.user.is_authenticated() %} - <input type="checkbox" id="question-subscribe-sidebar"/> - <label for="question-subscribe-sidebar">{% trans %}email the updates{% endtrans %}</label> - {%else%} - <input type="checkbox" id="question-subscribe-sidebar"/> - <label for="question-subscribe-sidebar">{% trans %}<strong>Here</strong> (once you log in) you will be able to sign up for the periodic email updates about this question.{% endtrans %}</label> - {%endif%} - <p class="rss"> - <a - href="{{settings.APP_URL}}/feeds/question/{{ question.id }}" - title="{% trans %}subscribe to this question rss feed{% endtrans %}" - >{% trans %}subsribe to rss feed{% endtrans %}</a> - </p> - </div> -</div> -{% cache 0 "questions_tags" questions_tags question.id language_code %} -{% if settings.SIDEBAR_QUESTION_SHOW_TAGS %} - <div class="boxC"> - <div class="clearfix"></div> - <h2> - {% trans %}Question tags{% endtrans %}: - </h2> - <ul id="related-tags" class="tags"> - {% for tag in tags %} - <li> - {{ macros.tag_widget( - tag, - html_tag = 'div', - url_params = 'start_over=true', - extra_content = '<span class="tag-number">× ' ~ - tag.used_count|intcomma ~ '</span>' - ) - }} - </li> - {% endfor %} - </ul> - </div> -{% endif %} - -{% if settings.SIDEBAR_QUESTION_SHOW_META %} -<div class="boxC"> - <div class="clearfix"></div> - <h2>{% trans %}Stats:{% endtrans %}</h2> - <p> - {% trans %}question asked{% endtrans %}: <strong title="{{ question.added_at }}">{{question.added_at|diff_date}}</strong> - </p> - <p> - {% trans %}question was seen{% endtrans %}: <strong>{{ question.view_count|intcomma }} {% trans %}times{% endtrans %}</strong> - </p> - <p> - {% trans %}last updated{% endtrans %}: <strong title="{{ question.last_activity_at }}">{{question.last_activity_at|diff_date}}</strong> - </p> -</div> -{% endif %} -{% endcache %} - -{% if similar_questions.data and settings.SIDEBAR_QUESTION_SHOW_RELATED %} - {#% cache 1800 "related_questions" related_questions question.id language_code %#} - <div class="boxC"> - <h2>{% trans %}Related questions{% endtrans %}</h2> - <div class="questions-related"> - {% for question in similar_questions.data() %} - <p> - <a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a> - </p> - {% endfor %} - </div> - </div> - {#% endcache %#} -{% endif %} - -{{ settings.SIDEBAR_QUESTION_FOOTER }} - +{%include "question/sidebar.html" %} {% endblock %} {% block endjs %} - {% if not question.closed %} - <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> - <script type='text/javascript'> - {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} - var codeFriendlyMarkdown = true; - {% else %} - var codeFriendlyMarkdown = false; - {% endif %} - var maxCommentLength = {{settings.MAX_COMMENT_LENGTH}}; - askbot['urls']['postComments'] = '{% url post_comments %}'; - askbot['urls']['editComment'] = '{% url edit_comment %}'; - askbot['urls']['deleteComment'] = '{% url delete_comment %}'; - askbot['urls']['getComment'] = '{% url get_comment %}'; - askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #} - askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}'; - askbot['urls']['vote_url_template'] = scriptUrl + '{% trans %}questions/{% endtrans %}{{ "{{QuestionID}}/" }}{% trans %}vote/{% endtrans %}'; - askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}'; - askbot['urls']['upvote_comment'] = '{% url upvote_comment %}'; - askbot['messages']['addComment'] = '{% trans %}add comment{% endtrans %}'; - {% if settings.SAVE_COMMENT_ON_ENTER %} - askbot['settings']['saveCommentOnEnter'] = true; - {% else %} - askbot['settings']['saveCommentOnEnter'] = false; - {% endif %} - </script> - <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> - {% endif %} - <script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script> - <script type='text/javascript' src='{{"/js/post.js"|media}}'></script> - <script type="text/javascript"> - // define reputation needs for comments - var repNeededForComments = 50; - $().ready(function(){ - {% if request.user.is_authenticated() %} - if ($('#question-subscribe-updates')[0].checked){ - $('#question-subscribe-sidebar').attr({'checked': 'checked'}); - } - {%endif%} - $("#nav_questions").attr('className',"on"); - var answer_sort_tab = "{{ tab_id }}"; - $("#" + answer_sort_tab).attr('className',"on"); - - Vote.init({{ question.id }}, '{{ question.title|slugify }}', '{{ question.author.id }}','{{ request.user.id }}'); - - {% if not question.closed and request.user.is_authenticated %}initEditor();{% endif %} - - lanai.highlightSyntax(); - $('#btLogin').bind('click', function(){window.location.href='{{ settings.LOGIN_URL }}'; } ) - if (window.location.hash === 'fmanswer'){ - $('#fmanswer textarea').focus(); - } - {% if settings.ENABLE_SHARING_GOOGLE %}$.getScript("http://apis.google.com/js/plusone.js"){% endif %} - - {% if request.user == question.author %} - $("#fmanswer_button").click(function() { - $("#fmanswer").show(); - $("#fmanswer_button").hide(); - }); - {%endif%} - }); - - $(window).bind('hashchange', animate_hashes); - - function animate_hashes(){ - var id_value = window.location.hash; - if (id_value != ""){ - var previous_color = $(id_value).css('background-color'); - $(id_value).css('backgroundColor', '#FFF8C6'); - $(id_value).animate({backgroundColor: '#ff7f2a'}, 1000).animate({backgroundColor: '#FFF8C6'}, 1000, function(){ - $(id_value).css('backgroundColor', previous_color); - }); - } - } - - - function initEditor(){ - $('#editor').TextAreaResizer(); - //highlight code synctax when editor has new text - $("#editor").typeWatch({highlight: false, wait: 3000, - captureLength: 5, callback: lanai.highlightSyntax}); - - var display = true; - var txt = "[{% trans %}hide preview{% endtrans %}]"; - $('#pre-collapse').text(txt); - $('#pre-collapse').bind('click', function(){ - txt = display ? "[{% trans %}show preview{% endtrans %}]" : "[{% trans %}hide preview{% endtrans %}]"; - display = !display; - $('#previewer').toggle(); - $('#pre-collapse').text(txt); - }); - setupFormValidation($("#fmanswer"), CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages()); - } - </script> - {% include "blocks/editor_data.html" %} +{%include "question/javascript.html" %} {% endblock %} + diff --git a/askbot/skins/default/templates/question/content.html b/askbot/skins/default/templates/question/content.html new file mode 100644 index 00000000..c849e3b6 --- /dev/null +++ b/askbot/skins/default/templates/question/content.html @@ -0,0 +1,279 @@ +{% 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> +<table style="width:100%;" id="question-table" {% if question.deleted %}class="deleted"{%endif%}> + <tr> + <td style="width:30px;vertical-align:top"> + <div class="vote-buttons"> + {% include "widgets/question_vote_buttons.html"%} + {% include "widgets/share_buttons.html"%} + </div> + </td> + <td> + <div class="question-body"> + {{question.html}} + </div> + <ul id="question-tags" class="post-tags tags"> + {% for tag in question.get_tag_names() %} + {{ macros.tag_widget( + tag, + css_class = 'post-tag', + html_tag = 'li' + ) + }} + {% endfor %} + </ul> + <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, + ) + }} + </div> + {{ + macros.post_comments_widget( + post = question, + show_post = show_post, + show_comment = show_comment, + comment_order_number = comment_order_number, + user = request.user, + max_comments = settings.MAX_COMMENTS_TO_SHOW + ) + }} + <!--/div--> + </td> + </tr> +</table> +{% if question.closed %} +<div class="question-status" style="margin-bottom:15px"> +<h3>{% trans close_reason=question.get_close_reason_display() %}The question has been closed for the following reason "{{ close_reason }}" by{% endtrans %} +<a href="{{ question.closed_by.get_profile_url() }}">{{ question.closed_by.username }}</a> +{% trans closed_at=question.closed_at %}close date {{closed_at}}{% endtrans %}</h3> +</div> +{% endif %} +{% if answers %} + <div class="tabBar"> + <h2 id="sort-top"> + {% trans counter=answers|length %} + {{counter}} Answer: + {% pluralize %} + {{counter}} Answers: + {% endtrans %} + </h2> + <div class="tabsA"> + <a id="oldest" href="{{ question.get_absolute_url() }}?sort=oldest#sort-top" + title="{% trans %}oldest answers will be shown first{% endtrans %}" + ><span>{% trans %}oldest answers{% endtrans %}</span></a> + <a id="latest" href="{{ question.get_absolute_url() }}?sort=latest#sort-top" + title="{% trans %}newest answers will be shown first{% endtrans %}" + ><span>{% trans %}newest answers{% endtrans %}</span></a> + <a id="votes" href="{{ question.get_absolute_url() }}?sort=votes#sort-top" + title="{% trans %}most voted answers will be shown first{% endtrans %}" + ><span>{% trans %}popular answers{% endtrans %}</span></a> + </div> + </div> + {{ utils_macros.paginator(paginator_context) }} + + {% for answer in answers %} + <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 %}"> + <table style="width:100%;" class="answer-table"> + <tr> + <td style="width:30px;vertical-align:top"> + <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 %} + </div> + </td> + <td> + <div class="item-right"> + <div class="answer-body"> + {{ answer.html }} + </div> + <div class="answer-controls post-controls"> + {% 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 + ) + }} + </div> + {{ + macros.post_comments_widget( + post = answer, + show_post = show_post, + show_comment = show_comment, + comment_order_number = comment_order_number, + user = request.user, + max_comments = settings.MAX_COMMENTS_TO_SHOW + ) + }} + </div> + </td> + </tr> + </table> + </div> + {% endfor %} + {{ utils_macros.paginator(paginator_context) }} +{% else %} + {% set question_url=settings.APP_URL+question.get_absolute_url()|urlencode %} + <h2 class="share-question">{% trans %}Know someone who can answer? Share a <a href="{{ question_url }}">link</a> to this question via{% endtrans %} + {% if settings.ENABLE_SHARING_TWITTER %}{{ macros.share(site = 'twitter', site_label = 'Twitter') }},{% endif %} + {% if settings.ENABLE_SHARING_FACEBOOK %}{{ macros.share(site = 'facebook', site_label = 'Facebook') }},{% endif %} + {% if settings.ENABLE_SHARING_LINKEDIN %}{{ macros.share(site = 'linkedin', site_label = 'LinkedIn') }},{% endif %} + {% if settings.ENABLE_SHARING_IDENTICA %}{{ macros.share(site = 'identica', site_label = 'Identi.ca') }},{% endif %} + {%- if settings.ENABLE_SHARING_TWITTER or settings.ENABLE_SHARING_FACEBOOK or settings.ENABLE_SHARING_LINKEDIN or settings.ENABLE_SHARING_IDENTICA -%} + {% trans %} or{% endtrans %} + {% endif %} + <a href="mailto:?subject={{ settings.APP_SHORT_NAME|urlencode }}&body={{ question_url }}">{% trans %}email{% endtrans %}</a>. + </h2> +{% endif %} +<form + id="fmanswer" + {% if user == question.author %}style="display:none"{% endif %} + action="{% url answer question.id %}" + method="post" +>{% csrf_token %} + {% if request.user.is_authenticated() %} + <p style="padding-left:3px"> + {{ answer.email_notify }} + <label for="question-subscribe-updates"> + {% set email_feed_frequency = request.user.get_followed_question_alert_frequency() %} + {% if email_feed_frequency =='n' %} + {% trans %}Notify me once a day when there are any new answers{% endtrans %} + {% elif email_feed_frequency =='d' %} + {% trans %}Notify me once a day when there are any new answers{% endtrans %} + {% elif email_feed_frequency =='w' %} + {% trans %}Notify me weekly when there are any new answers{% endtrans %} + {% elif email_feed_frequency =='i' %} + {% trans %}Notify me immediately when there are any new answers{% endtrans %} + {% endif %} + </label> + {% trans profile_url=request.user.get_profile_url() %}You can always adjust frequency of email updates from your {{profile_url}}{% endtrans %} + </p> + {% else %} + <p style="padding-left:3px"> + {{ answer.email_notify }} + <label>{% trans %}once you sign in you will be able to subscribe for any updates here{% endtrans %}</label> + </p> + {% endif %} + <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 style="padding:10px 0 0 0;"> + {% 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> + {% if request.user == question.author %} + <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/javascript.html b/askbot/skins/default/templates/question/javascript.html new file mode 100644 index 00000000..1e4e47ab --- /dev/null +++ b/askbot/skins/default/templates/question/javascript.html @@ -0,0 +1,95 @@ +{% if not question.closed %} + <script type='text/javascript' src='{{"/js/editor.js"|media}}'></script> + <script type='text/javascript'> + {% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %} + var codeFriendlyMarkdown = true; + {% else %} + var codeFriendlyMarkdown = false; + {% endif %} + var maxCommentLength = {{settings.MAX_COMMENT_LENGTH}}; + askbot['urls']['postComments'] = '{% url post_comments %}'; + askbot['urls']['editComment'] = '{% url edit_comment %}'; + askbot['urls']['deleteComment'] = '{% url delete_comment %}'; + askbot['urls']['getComment'] = '{% url get_comment %}'; + askbot['urls']['question_url_template'] = scriptUrl + '{% trans %}question/{% endtrans %}{{ "{{QuestionID}}/{{questionSlug}}" }}';{# yes it needs to be that whacky #} + askbot['urls']['user_signin'] = '{{ settings.LOGIN_URL }}'; + askbot['urls']['vote_url_template'] = scriptUrl + '{% trans %}questions/{% endtrans %}{{ "{{QuestionID}}/" }}{% trans %}vote/{% endtrans %}'; + askbot['urls']['swap_question_with_answer'] = '{% url swap_question_with_answer %}'; + askbot['urls']['upvote_comment'] = '{% url upvote_comment %}'; + askbot['messages']['addComment'] = '{% trans %}add comment{% endtrans %}'; + {% if settings.SAVE_COMMENT_ON_ENTER %} + askbot['settings']['saveCommentOnEnter'] = true; + {% else %} + askbot['settings']['saveCommentOnEnter'] = false; + {% endif %} + </script> + <script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script> + <script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script> +{% endif %} +<script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script> +<script type='text/javascript' src='{{"/js/post.js"|media}}'></script> +<script type="text/javascript"> + // define reputation needs for comments + var repNeededForComments = 50; + $().ready(function(){ + {% if request.user.is_authenticated() %} + if ($('#question-subscribe-updates')[0].checked){ + $('#question-subscribe-sidebar').attr({'checked': 'checked'}); + } + {%endif%} + $("#nav_questions").attr('className',"on"); + var answer_sort_tab = "{{ tab_id }}"; + $("#" + answer_sort_tab).attr('className',"on"); + + Vote.init({{ question.id }}, '{{ question.title|slugify }}', '{{ question.author.id }}','{{ request.user.id }}'); + + {% if not question.closed and request.user.is_authenticated %}initEditor();{% endif %} + + lanai.highlightSyntax(); + $('#btLogin').bind('click', function(){window.location.href='{{ settings.LOGIN_URL }}'; } ) + if (window.location.hash === 'fmanswer'){ + $('#fmanswer textarea').focus(); + } + {% if settings.ENABLE_SHARING_GOOGLE %}$.getScript("http://apis.google.com/js/plusone.js"){% endif %} + + {% if request.user == question.author %} + $("#fmanswer_button").click(function() { + $("#fmanswer").show(); + $("#fmanswer_button").hide(); + }); + {%endif%} + }); + + $(window).bind('hashchange', animate_hashes); + + function animate_hashes(){ + var id_value = window.location.hash; + if (id_value != ""){ + var previous_color = $(id_value).css('background-color'); + $(id_value).css('backgroundColor', '#FFF8C6'); + $(id_value).animate({backgroundColor: '#ff7f2a'}, 1000).animate({backgroundColor: '#FFF8C6'}, 1000, function(){ + $(id_value).css('backgroundColor', previous_color); + }); + } + } + + + function initEditor(){ + $('#editor').TextAreaResizer(); + //highlight code synctax when editor has new text + $("#editor").typeWatch({highlight: false, wait: 3000, + captureLength: 5, callback: lanai.highlightSyntax}); + + var display = true; + var txt = "[{% trans %}hide preview{% endtrans %}]"; + $('#pre-collapse').text(txt); + $('#pre-collapse').bind('click', function(){ + txt = display ? "[{% trans %}show preview{% endtrans %}]" : "[{% trans %}hide preview{% endtrans %}]"; + display = !display; + $('#previewer').toggle(); + $('#pre-collapse').text(txt); + }); + setupFormValidation($("#fmanswer"), CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages()); + } +</script> +{% include "blocks/editor_data.html" %} diff --git a/askbot/skins/default/templates/question/sidebar.html b/askbot/skins/default/templates/question/sidebar.html new file mode 100644 index 00000000..16952c79 --- /dev/null +++ b/askbot/skins/default/templates/question/sidebar.html @@ -0,0 +1,98 @@ +{% import "macros/macros.html" as macros %} +{{ settings.SIDEBAR_QUESTION_HEADER }} +<div class="boxC vote-buttons"> + <h2 style="font-size: 22px;margin-top: 11px; text-align: left;">{% trans %}Question tools{% endtrans %}</h2> + {% if favorited %} + <a class="button followed" + alt="{% trans %}click to unfollow this question{% endtrans %}"> + <div>{% trans %}Following{% endtrans %}</div> + <div class='unfollow'>{% trans %}Unfollow{% endtrans %}</div> + </a> + {% else %} + <a class="button follow" + alt="{% trans %}click to follow this question{% endtrans %}"> + {%trans %}Follow{%endtrans%} + </a> + {% endif %} + <div class="clearfix"></div> + <div id="favorite-number" class="favorite-number{% if favorited %} my-favorite-number{% endif %}"> + {% set follower_count = question.favourite_count %} + {% if follower_count > 0 %} + {% trans count=follower_count %}{{count}} follower{% pluralize %}{{count}} followers{% endtrans %} + {% endif %} + </div> + <div class="notify-sidebar"> + {%if request.user.is_authenticated() %} + <input type="checkbox" id="question-subscribe-sidebar"/> + <label for="question-subscribe-sidebar">{% trans %}email the updates{% endtrans %}</label> + {%else%} + <input type="checkbox" id="question-subscribe-sidebar"/> + <label for="question-subscribe-sidebar">{% trans %}<strong>Here</strong> (once you log in) you will be able to sign up for the periodic email updates about this question.{% endtrans %}</label> + {%endif%} + <p class="rss"> + <a + href="{{settings.APP_URL}}/feeds/question/{{ question.id }}" + title="{% trans %}subscribe to this question rss feed{% endtrans %}" + >{% trans %}subsribe to rss feed{% endtrans %}</a> + </p> + </div> +</div> +{% cache 0 "questions_tags" questions_tags question.id language_code %} +{% if settings.SIDEBAR_QUESTION_SHOW_TAGS %} + <div class="boxC"> + <div class="clearfix"></div> + <h2> + {% trans %}Question tags{% endtrans %}: + </h2> + <ul id="related-tags" class="tags"> + {% for tag in tags %} + <li> + {{ macros.tag_widget( + tag, + html_tag = 'div', + url_params = 'start_over=true', + extra_content = '<span class="tag-number">× ' ~ + tag.used_count|intcomma ~ '</span>' + ) + }} + </li> + {% endfor %} + </ul> + </div> +{% endif %} + +{% if settings.SIDEBAR_QUESTION_SHOW_META %} +<div class="boxC"> + <div class="clearfix"></div> + <h2>{% trans %}Stats:{% endtrans %}</h2> + <p> + {% trans %}question asked{% endtrans %}: <strong title="{{ question.added_at }}">{{question.added_at|diff_date}}</strong> + </p> + <p> + {% trans %}question was seen{% endtrans %}: <strong>{{ question.view_count|intcomma }} {% trans %}times{% endtrans %}</strong> + </p> + <p> + {% trans %}last updated{% endtrans %}: <strong title="{{ question.last_activity_at }}">{{question.last_activity_at|diff_date}}</strong> + </p> +</div> +{% endif %} +{% endcache %} + +{% if similar_questions.data and settings.SIDEBAR_QUESTION_SHOW_RELATED %} + {#% cache 1800 "related_questions" related_questions question.id language_code %#} + <div class="boxC"> + <h2>{% trans %}Related questions{% endtrans %}</h2> + <div class="questions-related"> + {% for question in similar_questions.data() %} + <p> + <a href="{{ question.get_absolute_url() }}">{{ question.get_question_title() }}</a> + </p> + {% endfor %} + </div> + </div> + {#% endcache %#} +{% endif %} + +{{ settings.SIDEBAR_QUESTION_FOOTER }} + + |