diff options
Diffstat (limited to 'askbot/skins')
14 files changed, 242 insertions, 145 deletions
diff --git a/askbot/skins/common/media/js/post.js b/askbot/skins/common/media/js/post.js index dc3fbfd7..0ad59c69 100644 --- a/askbot/skins/common/media/js/post.js +++ b/askbot/skins/common/media/js/post.js @@ -311,7 +311,6 @@ var Vote = function(){ var removeAllOffensiveIdPrefixAnswerFlag = 'answer-offensive-remove-all-flag-'; var offensiveClassFlag = 'offensive-flag'; var questionControlsId = 'question-controls'; - var removeQuestionLinkIdPrefix = 'question-delete-link-'; var removeAnswerLinkIdPrefix = 'answer-delete-link-'; var questionSubscribeUpdates = 'question-subscribe-updates'; var questionSubscribeSidebar= 'question-subscribe-sidebar'; @@ -419,11 +418,6 @@ var Vote = function(){ return $(removeAllOffensiveAnswerFlag); }; - var getremoveQuestionLink = function(){ - var removeQuestionLink = 'div#question-controls a[id^='+ removeQuestionLinkIdPrefix +']'; - return $(removeQuestionLink); - }; - var getquestionSubscribeUpdatesCheckbox = function(){ return $('#' + questionSubscribeUpdates); }; @@ -464,7 +458,7 @@ var Vote = function(){ var bindEvents = function(){ // accept answers - var acceptedButtons = 'div.'+ voteContainerId +' img[id^='+ imgIdPrefixAccept +']'; + var acceptedButtons = 'div.'+ voteContainerId +' div[id^='+ imgIdPrefixAccept +']'; $(acceptedButtons).unbind('click').click(function(event){ Vote.accept($(event.target)); }); @@ -520,10 +514,6 @@ var Vote = function(){ Vote.remove_all_offensive(this, VoteType.removeAllOffensiveAnswer); }); - //getremoveQuestionLink().unbind('click').click(function(event){ - // Vote.remove(this, VoteType.removeQuestion); - //}); - getquestionSubscribeUpdatesCheckbox().unbind('click').click(function(event){ //despeluchar esto if (this.checked){ @@ -578,19 +568,15 @@ var Vote = function(){ showMessage(object, acceptOwnAnswerMessage); } else if(data.status == "1"){ - object.attr("src", mediaUrl("media/images/vote-accepted.png")); $("#"+answerContainerIdPrefix+postId).removeClass("accepted-answer"); $("#"+commentLinkIdPrefix+postId).removeClass("comment-link-accepted"); } else if(data.success == "1"){ - var acceptedButtons = 'div.'+ voteContainerId +' img[id^='+ imgIdPrefixAccept +']'; - $(acceptedButtons).attr("src", mediaUrl("media/images/vote-accepted.png")); var answers = ("div[id^="+answerContainerIdPrefix +"]"); $(answers).removeClass("accepted-answer"); var commentLinks = ("div[id^="+answerContainerIdPrefix +"] div[id^="+ commentLinkIdPrefix +"]"); $(commentLinks).removeClass("comment-link-accepted"); - object.attr("src", mediaUrl("media/images/vote-accepted-on.png")); $("#"+answerContainerIdPrefix+postId).addClass("accepted-answer"); $("#"+commentLinkIdPrefix+postId).addClass("comment-link-accepted"); } diff --git a/askbot/skins/common/templates/question/answer_controls.html b/askbot/skins/common/templates/question/answer_controls.html index fd12c856..091572af 100644 --- a/askbot/skins/common/templates/question/answer_controls.html +++ b/askbot/skins/common/templates/question/answer_controls.html @@ -8,26 +8,18 @@ {% trans %}link{% endtrans %} </a> </span> -{% if request.user.is_authenticated() and - ( - request.user == answer.author or - request.user.is_administrator_or_moderator() - ) -%} -<span class="action-link delete-post"> +<span id='delete-answer-{{answer.id}}' class="action-link delete-post"> <a class="question-delete" >{% if answer.deleted %}{% trans %}undelete{% endtrans %}{% else %}{% trans %}delete{% endtrans %}{% endif %}</a> </span> +{% if answer.offensive_flag_count > 0 %} <span - id="answer-offensive-flag-{{ answer.id }}" + id="answer-offensive-remove-flag-{{ answer.id }}" class="action-link offensive-flag" - title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}" + title="{% trans %}remove offensive flag{% endtrans %}" > - <a class="question-flag">{% trans %}flag offensive{% endtrans %} - <span class="darkred">{% if answer.offensive_flag_count > 0 %}({{ answer.offensive_flag_count }}){% endif %}</span> - </a> + <a class="question-flag">{% trans %}remove flag{% endtrans %}</a> </span> -{% if answer.offensive_flag_count > 0 %} <span id="answer-offensive-flag-{{ answer.id }}" class="action-link offensive-flag" @@ -36,13 +28,6 @@ <a class="question-flag">{% trans %}flag offensive{% endtrans %} ({{ answer.offensive_flag_count }})</a> </a> </span> -<span - id="answer-offensive-flag-remove-{{ answer.id }}" - class="action-link offensive-flag" - title="{% trans %}remove offensive flag{% endtrans %}" -> - <a class="question-flag">{% trans %}remove flag{% endtrans %} ({{ answer.offensive_flag_count }})</a> -</span> {% else %} <span id="answer-offensive-flag-{{ answer.id }}" @@ -52,7 +37,20 @@ <a class="question-flag">{% trans %}flag offensive{% endtrans %}</a> </span> {% endif %} -<span class="action-link"> +<span id='edit-answer-{{answer.id}}' class="action-link"> <a class="question-edit" href="{% url edit_answer answer.id %}">{% trans %}edit{% endtrans %}</a> </span> -{% endif %} +<script type="text/javascript"> + (function(){ + var del_link = document.getElementById( + 'delete-answer-' + '{{answer.id}}' + ); + var edit_link = document.getElementById( + 'edit-answer-' + '{{answer.id}}' + ); + if (askbot['data']['userIsAuthenticated'] === false){ + del_link.parentNode.removeChild(del_link); + edit_link.parentNode.removeChild(edit_link); + } + })(); +</script> diff --git a/askbot/skins/common/templates/question/answer_vote_buttons.html b/askbot/skins/common/templates/question/answer_vote_buttons.html index 9097fec2..242bf2be 100644 --- a/askbot/skins/common/templates/question/answer_vote_buttons.html +++ b/askbot/skins/common/templates/question/answer_vote_buttons.html @@ -1,20 +1,10 @@ -{{ macros.post_vote_buttons(post = answer, visitor_vote = user_answer_votes[answer.id]) }} -<img id="answer-img-accept-{{ answer.id }}" class="answer-img-accept" +{{ macros.post_vote_buttons(post = answer) }} +<div + id="answer-img-accept-{{ answer.id }}" + class="answer-img-accept" {% if answer.accepted() %} - src="{{'/images/vote-accepted-on.png'|media}}" + title="{% trans %}this answer has been selected as correct{% endtrans %}" {% else %} - src="{{'/images/vote-accepted.png'|media}}" + title="{% trans %}mark this answer as correct (click again to undo){% endtrans %}" {% endif %} - {% if request.user.is_authenticated() and - ( - request.user == question.author or - request.user.is_administrator_or_moderator() - ) - %} - alt="{% trans %}mark this answer as correct (click again to undo){% endtrans %}" - title="{% trans %}mark this answer as correct (click again to undo){% endtrans %}" - {% else %} - alt="{% trans question_author=question.author.username %}{{question_author}} has selected this answer as correct{% endtrans %}" - title="{% trans question_author=question.author.username%}{{question_author}} has selected this answer as correct{% endtrans %}" - {% endif %} - /> +></div> diff --git a/askbot/skins/common/templates/question/question_controls.html b/askbot/skins/common/templates/question/question_controls.html index 4710559d..5eee380a 100644 --- a/askbot/skins/common/templates/question/question_controls.html +++ b/askbot/skins/common/templates/question/question_controls.html @@ -15,17 +15,17 @@ {% endif %} {% if question.offensive_flag_count > 0 %} <span - id="question-offensive-flag-{{ question.id }}" class="offensive-flag" + id="question-offensive-remove-flag-{{ question.id }}" + class="offensive-flag" title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}" > - <a class="question-flag">{% trans %}flag offensive{% endtrans %} {{ question.offensive_flag_count }})</a> + <a class="question-flag">{% trans %}remove flag{% endtrans %}</a> </span> <span - id="question-offensive-flag-remove-{{ question.id }}" - class="offensive-flag" + id="question-offensive-flag-{{ question.id }}" class="offensive-flag" title="{% trans %}report as offensive (i.e containing spam, advertising, malicious text, etc.){% endtrans %}" > - <a class="question-flag">{% trans %}remove flag{% endtrans %} ({{ question.offensive_flag_count }})</a> + <a class="question-flag">{% trans %}flag offensive{% endtrans %} ({{ question.offensive_flag_count }})</a> </span> {% else %} <span diff --git a/askbot/skins/common/templates/question/question_vote_buttons.html b/askbot/skins/common/templates/question/question_vote_buttons.html index 8466beb9..6b8774cc 100644 --- a/askbot/skins/common/templates/question/question_vote_buttons.html +++ b/askbot/skins/common/templates/question/question_vote_buttons.html @@ -1 +1 @@ -{{ macros.post_vote_buttons(post = question, visitor_vote = user_question_vote) }} +{{ macros.post_vote_buttons(post = question) }} diff --git a/askbot/skins/default/media/style/style.less b/askbot/skins/default/media/style/style.less index e8e5a5d8..4f096bd0 100644 --- a/askbot/skins/default/media/style/style.less +++ b/askbot/skins/default/media/style/style.less @@ -2034,9 +2034,17 @@ ul#related-tags li { } } + .answer-img-accept { + background: url(../images/vote-accepted.png); + width: 23px; + height: 23px; + } + + .accepted-answer .answer-img-accept, .answer-img-accept:hover { background: url(../images/vote-accepted-on.png) } + .answer-body a { color:@link; } diff --git a/askbot/skins/default/templates/base.html b/askbot/skins/default/templates/base.html index bd19f707..bc0a8d6c 100644 --- a/askbot/skins/default/templates/base.html +++ b/askbot/skins/default/templates/base.html @@ -9,6 +9,7 @@ {% include "meta/html_head_stylesheets.html" %} {% block forestyle %}{% endblock %} {% include "meta/html_head_javascript.html" %} + {% block forejs %}{% endblock %} {% if settings.USE_CUSTOM_HTML_HEAD %} {{ settings.CUSTOM_HTML_HEAD }} {% endif %} diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html index 93eae41b..e0de6bb6 100644 --- a/askbot/skins/default/templates/macros.html +++ b/askbot/skins/default/templates/macros.html @@ -23,16 +23,10 @@ </div> {%- endmacro -%} -{%- macro post_vote_buttons(post = None, visitor_vote = None) -%} -<div - id="{{post.post_type}}-img-upvote-{{ post.id }}" - class="{{post.post_type}}-img-upvote post-vote{% if visitor_vote == 1 %} on{% endif %}" - {% if post.post_type == 'question' %} - title="{% trans %}i like this question (click again to cancel){% endtrans %}" - {% else %} - title="{% trans %}i like this answer (click again to cancel){% endtrans %}" - {% endif %} -/></div> +{%- macro post_vote_buttons(post = None) -%} +<div id="{{post.post_type}}-img-upvote-{{ post.id }}" + class="{{post.post_type}}-img-upvote post-vote"> +</div> <div id="{{post.post_type}}-vote-number-{{ post.id }}" class="vote-number" @@ -40,13 +34,11 @@ >{{ post.score }}</div> <div id="{{post.post_type}}-img-downvote-{{ post.id }}" - class="{{post.post_type}}-img-downvote post-vote{% if visitor_vote == -1 %} on{% endif %}" - {% if post.post_type == 'question' %} - title="{% trans %}i dont like this question (click again to cancel){% endtrans %}" - {% else %} - title="{% trans %}i dont like this answer (click again to cancel){% endtrans %}" - {% endif %} -/></div> + class="{{post.post_type}}-img-downvote post-vote"> +</div> +<script type="text/javascript"> + askbot['functions']['renderPostVoteButtons']('{{post.post_type}}', '{{post.id}}'); +</script> {%- endmacro -%} {%- macro post_contributor_avatar_and_credentials(post, user) -%} @@ -244,27 +236,22 @@ poor design of the data or methods on data objects #} {# Warning! Any changes to the comment markup here must be duplicated in post.js for the purposes of the AJAX comment editor #} -{%- macro add_or_show_comments_button(post = None, can_post = None, max_comments = None, widget_id = None) -%} +{%- macro add_or_show_comments_button(post = None, max_comments = None, widget_id = None) -%} + {% if post.comment_count > max_comments %} + {% set remaining_comment_count = post.comment_count - max_comments %} + {% else %} + {% set remaining_comment_count = 0 %} + {% endif %} + <a id="add-comment-to-post-{{post.id}}" class="button"></a> <script type="text/javascript"> askbot['data']['{{widget_id}}'] = { - can_post: {% if can_post %}true{% else %}false{% endif %}, truncated: {% if post.comment_count > max_comments %}true{% else %}false{% endif %} }; + askbot['functions']['renderAddCommentButton']( + '{{post.id}}', + {{remaining_comment_count}} + ); </script> - {% if post.comment_count > max_comments %} - {% set remaining_comments = post.comment_count - max_comments %} - <a class="button"> - {% if can_post %} - {% trans %}post a comment{% endtrans %} / - {% trans counter=remaining_comments %}see <strong>{{counter}}</strong> more{% pluralize %}see <strong>{{counter}}</strong> more{% endtrans %} - {% else %} - {% trans counter=remaining_comments %}see <strong>{{counter}}</strong> more comment{% pluralize %}see <strong>{{counter}}</strong> more comments - {% endtrans %} - {% endif %} - </a> - {% elif can_post %} - <a class="button">{% trans %}post a comment{% endtrans %}</a> - {% endif %} {%- endmacro -%} {%- macro post_comments_widget( @@ -285,9 +272,9 @@ for the purposes of the AJAX comment editor #} <div class="comments" id="{{widget_id}}"> <div class="content"> {% if show_post == post and show_comment and show_comment_position > max_comments %} - {% set comments = post._cached_comments[:show_comment_position] %} + {% set comments = post.get_cached_comments()[:show_comment_position] %} {% else %} - {% set comments = post._cached_comments[:max_comments] %} + {% set comments = post.get_cached_comments()[:max_comments] %} {% endif %} {% for comment in comments %} {# Warning! Any changes to the comment markup IN THIS `FOR` LOOP must be duplicated in post.js @@ -295,35 +282,42 @@ for the purposes of the AJAX comment editor #} <div class="comment" id="comment-{{comment.id}}"> <div class="comment-votes"> {% if comment.score > 0 %} - <div class="upvote{% if comment.upvoted_by_user %} upvoted{% endif %}">{{comment.score}}</div> + <div + id="comment-img-upvote-{{comment.id}}" + class="upvote" + >{{comment.score}}</div> + <script type="text/javascript"> + askbot['functions']['renderPostVoteButtons']('comment', '{{comment.id}}'); + </script> {% else %} <div class="upvote"></div> {% endif %} </div> - <div class="comment-delete"> - {% if user|can_delete_comment(comment) %} - <span class="delete-icon" title="{% trans %}delete this comment{% endtrans %}"></span> - {% endif %} + <div + id="post-{{comment.id}}-delete" + class="comment-delete" + > + <span class="delete-icon" title="{% trans %}delete this comment{% endtrans %}"></span> </div> <div class="comment-body"> {{comment.html}} <a class="author" href="{{comment.author.get_profile_url()}}">{{comment.author.username}}</a> <span class="age"> ({{comment.added_at|diff_date}})</span> - {% if user|can_edit_comment(comment) %} - <a class="edit">{% trans %}edit{% endtrans %}</a> - {% endif %} + <a id="post-{{comment.id}}-edit" + class="edit">{% trans %}edit{% endtrans %}</a> </div> </div> + <script type="text/javascript"> + askbot['functions']['renderPostControls']('{{comment.id}}'); + </script> {% endfor %} </div> <div class="controls"> - {% set can_post = user.is_authenticated() and user.can_post_comment(post) %} {% if show_post == post and show_comment %} {% if show_comment_position > max_comments %} {{ add_or_show_comments_button( post = post, - can_post = can_post, max_comments = show_comment_position, widget_id = widget_id ) @@ -332,7 +326,6 @@ for the purposes of the AJAX comment editor #} {{ add_or_show_comments_button( post = post, - can_post = can_post, max_comments = max_comments, widget_id = widget_id ) @@ -342,7 +335,6 @@ for the purposes of the AJAX comment editor #} {{ add_or_show_comments_button( post = post, - can_post = can_post, max_comments = max_comments, widget_id = widget_id ) diff --git a/askbot/skins/default/templates/meta/bottom_scripts.html b/askbot/skins/default/templates/meta/bottom_scripts.html index dd5cb202..244cec21 100644 --- a/askbot/skins/default/templates/meta/bottom_scripts.html +++ b/askbot/skins/default/templates/meta/bottom_scripts.html @@ -12,16 +12,6 @@ var scriptUrl = '/{{settings.ASKBOT_URL}}' var askbotSkin = '{{settings.ASKBOT_DEFAULT_SKIN}}'; var enableMathJax = {% if settings.ENABLE_MATHJAX %}true{% else %}false{% endif %}; - {% if request.user.is_authenticated() %} - askbot['data']['userIsAuthenticated'] = true; - askbot['data']['userId'] = {{request.user.id}}; - askbot['data']['userIsAdminOrMod'] = {% if - request.user.is_administrator() - or request.user.is_moderator() - %}true{% else %}false{% endif %}; - {% else %} - askbot['data']['userIsAuthenticated'] = false; - {% endif %} askbot['urls']['mark_read_message'] = '{% url "read_message" %}'; askbot['urls']['get_tags_by_wildcard'] = '{% url "get_tags_by_wildcard" %}'; askbot['urls']['get_tag_list'] = '{% url "get_tag_list" %}'; diff --git a/askbot/skins/default/templates/meta/html_head_javascript.html b/askbot/skins/default/templates/meta/html_head_javascript.html index 2d453215..65d0bdce 100644 --- a/askbot/skins/default/templates/meta/html_head_javascript.html +++ b/askbot/skins/default/templates/meta/html_head_javascript.html @@ -2,10 +2,20 @@ <script type="text/javascript"> var askbot = {}; askbot['data'] = {}; + {% if request.user.is_authenticated() %} + askbot['data']['userIsAuthenticated'] = true; + askbot['data']['userId'] = {{request.user.id}}; + askbot['data']['userIsAdminOrMod'] = {% if + request.user.is_administrator() + or request.user.is_moderator() + %}true{% else %}false{% endif %}; + askbot['data']['userReputation'] = {{request.user.reputation}}; + {% else %} + askbot['data']['userIsAuthenticated'] = false; + askbot['data']['userReputation'] = 0; + {% endif %} askbot['urls'] = {}; askbot['settings'] = {}; askbot['messages'] = {}; </script> -{% block forejs %} -{% endblock %} {# avoid adding javascript here so that pages load faster #} diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html index b2462faf..bc0dbdeb 100644 --- a/askbot/skins/default/templates/question.html +++ b/askbot/skins/default/templates/question.html @@ -9,15 +9,148 @@ <link rel="canonical" href="{{settings.APP_URL|strip_path}}{{question.get_absolute_url()}}" /> <link rel="stylesheet" type="text/css" href="{{'/js/wmd/wmd.css'|media}}" /> {% endblock %} +{% block forejs %} + <script type="text/javascript"> + //below is pure cross-browser javascript, no jQuery + (function(){ + var data = askbot['data']; + if (data['userIsAuthenticated']){ + var votes = {}; + {% for post_id in user_votes %} + votes['{{post_id}}'] = {{user_votes[post_id]}}; + {% endfor %} + data['user_votes'] = votes; + var posts = {}; + {% for post_id in user_post_id_list %} + posts['{{post_id}}'] = 1; + {% endfor %} + data['user_posts'] = posts; + } + + function render_vote_buttons(post_type, post_id){ + var upvote_btn = document.getElementById( + post_type + '-img-upvote-' + post_id + ); + var downvote_btn = document.getElementById( + post_type + '-img-downvote-' + post_id + ); + if (data['userIsAuthenticated']){ + if (post_id in data['user_votes']){ + var vote = data['user_votes'][post_id]; + if (vote == -1){ + var btn = downvote_btn; + } else if (vote == 1){ + var btn = upvote_btn; + } else { + return; + } + if (post_type == 'comment'){ + btn.className = btn.className + ' upvoted'; + } else { + btn.className = btn.className + ' on'; + } + } + } + } + function render_post_controls(post_id){ + if (data['userIsAdminOrMod']){ + return;//all functions on + } + var edit_btn = document.getElementById( + 'post-' + post_id + '-edit' + ) + if (post_id in data['user_posts']){ + //todo: remove edit button from older comments + return;//same here + } + if ( + data['userReputation'] < + {{settings.MIN_REP_TO_DELETE_OTHERS_COMMENTS}} + ) { + var delete_btn = document.getElementById( + 'post-' + post_id + '-delete' + ); + delete_btn.parentNode.removeChild(delete_btn); + } + edit_btn.parentNode.removeChild(edit_btn); + } + function render_add_comment_button(post_id, extra_comment_count){ + var can_add = false; + {% if user_can_post_comment %} + can_add = true; + {% else %} + if (post_id in data['user_posts']){ + can_add = true; + } + {% endif %} + var add_comment_btn = document.getElementById( + 'add-comment-to-post-' + post_id + ); + if (can_add === false){ + add_comment_btn.parentNode.removeChild(add_comment_btn); + return; + } + + var text = ''; + if (extra_comment_count > 0){ + if (can_add){ + text = + "{% trans %}post a comment / <strong>some</strong> more{% endtrans %}"; + } else { + text = + "{% trans %}see <strong>some</strong> more{% endtrans%}"; + } + } else { + if (can_add){ + text = "{% trans %}post a comment{% endtrans %}"; + } + } + add_comment_btn.innerHTML = text; + //add the count + for (node in add_comment_btn.childNodes){ + if (node.nodeName === 'strong'){ + node.innerHTML = extra_comment_count; + break; + } + } + } + askbot['functions'] = askbot['functions'] || {}; + askbot['functions']['renderPostVoteButtons'] = render_vote_buttons; + askbot['functions']['renderPostControls'] = render_post_controls; + askbot['functions']['renderAddCommentButton'] = render_add_comment_button; + })(); + </script> +{% endblock %} {% block content %} - {# ==== BEGIN: question/content.html ==== #} - {% include "question/content.html" %} - {# ==== END: question/content.html ==== #} + {% if is_cacheable %} + {% cache long_time "thread-content-html" thread.id %} + {% include "question/content.html" %} + {% endcache %} + {% else %} + {% include "question/content.html" %} + {% endif %} {% endblock %} {% block sidebar %} - {%include "question/sidebar.html" %} + {% include "question/sidebar.html" %} {% endblock %} {% block endjs %} - {%include "question/javascript.html" %} + {% include "question/javascript.html" %} + {# + <script type="text/javascript"> + var messages = askbot['messages']; + messages['upvote_question'] = gettext( + 'I like this question (click again to cancel)' + ); + messages['upvote_answer'] = gettext( + 'I like this answer (click again to cancel)' + ); + messages['downvote_question'] = gettext( + "I don't like this question (click again to cancel)" + ); + messages['downvote_answer'] = gettext( + "I don't like this answer (click again to cancel)" + ); + </script> + #} {% endblock %} diff --git a/askbot/skins/default/templates/question/answer_card.html b/askbot/skins/default/templates/question/answer_card.html index d71131a8..7161c186 100644 --- a/askbot/skins/default/templates/question/answer_card.html +++ b/askbot/skins/default/templates/question/answer_card.html @@ -7,29 +7,21 @@ id="post-id-{{ answer.id }}" class="{{ macros.answer_classes(answer, question) }}"> <div class="vote-buttons"> - {# ==== START: question/answer_vote_buttons.html ==== #} {% include "question/answer_vote_buttons.html" %} - {# ==== END: question/answer_vote_buttons.html ==== #} </div> <div class="answer-table"> <div class="item-right"> <div class="answer-body"> <div class="post-update-info-container"> - {# ==== START: question/answer_author_info.html ==== #} {% include "question/answer_author_info.html" %} - {# ==== END: question/answer_author_info.html ==== #} </div> {{ answer.html }} </div> <div class="answer-controls post-controls"> - {# ==== START: question/answer_controls.html ==== #} {% include "question/answer_controls.html" %} - {# ==== END: question/answer_controls.html ==== #} </div> - {# ==== START: question/answer_comments.html ==== #} {% include "question/answer_comments.html" %} - {# ==== END: question/answer_comments.html ==== #} </div> </div> <div class="clean"></div> diff --git a/askbot/skins/default/templates/question/javascript.html b/askbot/skins/default/templates/question/javascript.html index 8ad3f09c..3a29579d 100644 --- a/askbot/skins/default/templates/question/javascript.html +++ b/askbot/skins/default/templates/question/javascript.html @@ -42,7 +42,7 @@ var answer_sort_tab = "{{ tab_id }}"; $("#" + answer_sort_tab).attr('className',"on"); - Vote.init({{ question.id }}, '{{ thread.title|slugify }}', '{{ question.author.id }}','{{ request.user.id }}'); + Vote.init({{ question.id }}, '{{ thread.title|slugify }}', '{{ question.author_id }}','{{ request.user.id }}'); {% if not thread.closed and request.user.is_authenticated %}initEditor();{% endif %} @@ -53,7 +53,7 @@ } {% if settings.ENABLE_SHARING_GOOGLE %}$.getScript("http://apis.google.com/js/plusone.js"){% endif %} - {% if request.user == question.author %} + {% if request.user.id == question.author_id %} $("#fmanswer_button").click(function() { $("#fmanswer").show(); $("#fmanswer_button").hide(); diff --git a/askbot/skins/default/templates/question/question_card.html b/askbot/skins/default/templates/question/question_card.html index 7077a8d1..08f7ccee 100644 --- a/askbot/skins/default/templates/question/question_card.html +++ b/askbot/skins/default/templates/question/question_card.html @@ -1,34 +1,31 @@ <div class="vote-buttons"> - {# ==== BEGIN: question/question_vote_buttons.html ==== #} {% include "question/question_vote_buttons.html" %} - {# ==== END: question/question_vote_buttons.html ==== #} - {# ==== BEGIN: question/share_buttons.html ==== #} {% include "question/share_buttons.html" %} - {# ==== END: question/share_buttons.html ==== #} </div> <div id="post-id-{{question.id}}" class="question-content{% if question.deleted %} deleted{% endif %}"> <h1><a href="{{ question.get_absolute_url() }}">{{ thread.get_title(question)|escape }}</a></h1> {% include "question/question_tags.html" %} - {# ==== END: question/question_tags.html" #} <div id="question-table"> <div class="question-body"> <div class="post-update-info-container"> - {# ==== START: "question/question_author_info.html" #} {% include "question/question_author_info.html" %} - {# ==== END: "question/question_author_info.html" #} </div> {{ question.html }} </div> <div id="question-controls" class="post-controls"> - {# ==== START: include "question/question_controls.html" #} {% include "question/question_controls.html" %} - {# ==== END: include "question/question_controls.html" #} </div> - {# ==== START: question/question_comments.html ==== #} + <script type="text/javascript"> + (function(){ + if (askbot['data']['userIsAuthenticated'] === false){ + var ctrl = document.getElementById('question-controls') + ctrl.parentNode.removeChild(ctrl); + } + })(); + </script> {% include "question/question_comments.html" %} - {# ==== END: question/question_comments.html ==== #} </div> </div> |