summaryrefslogtreecommitdiffstats
path: root/askbot/skins/default/templates/question.html
blob: 29301e301fb9319737f0eec40b596b83f4003851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{% extends "two_column_body.html" %}
<!-- question.html -->
{% block title %}{% spaceless %}{{ question.get_question_title()|escape }}{% endspaceless %}{% endblock %}
{% block meta_description %}
        <meta name="description" content="{{question.summary|striptags|escape}}" />
{% endblock %}
{% block keywords %}{{thread.tagname_meta_generator()}}{% endblock %}
{% block forestyle %}
    <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">
        (function(){
            var data = askbot['data'];
            if (data['userIsAuthenticated']){
                var votes = {};
                votes['{{question.id}}'] = {{user_question_vote}};
                {% for answer_id in user_answer_votes %}
                    votes['{{answer_id}}'] = {{user_answer_votes[answer_id]}};
                {% endfor %}
                data['user_votes'] = votes;
            }

            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;
                        }
                        btn.className = btn.className + ' on';
                    }
                }
            }
            askbot['functions'] = askbot['functions'] || {};
            askbot['functions']['renderPostVoteButtons'] = render_vote_buttons;
        })();
    </script>
{% endblock %}
{% block content %}
    {% if is_cacheable %}
        {% cache 1000 "thread" thread.id %}
            {% include "question/content.html" %}
        {% endcache %}
    {% else %}
        {% include "question/content.html" %}
    {% endif %}
{% endblock %}
{% block sidebar %}
    {% include "question/sidebar.html" %}
{% endblock %}
{% block endjs %}
    {% 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 %}