summaryrefslogtreecommitdiffstats
path: root/askbot/skins/default/templates/question/sidebar.html
blob: 6c4643e982ab0b2554ad91f60bb599cb7312c20c (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{% import "macros.html" as macros %}
{% if settings.SIDEBAR_QUESTION_HEADER %}
<div class="box">
    {{ settings.SIDEBAR_QUESTION_HEADER }}
</div>
{% endif %}
<div class="box vote-buttons">
    <h2 >{% 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 followed"
            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 = thread.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"
            {% if thread.is_followed_by(request.user) %}
                checked="checked"
            {% endif %}
        />
        <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 %}subscribe to rss feed{% endtrans %}</a>
        </p>
    </div> 
</div>

<div class="clearfix"></div>
<div class="box sharing-widget">
    {% if thread.is_private() %}
        <h2>{% trans %}Share{% endtrans %}</h2>
        <label for="share_user_name">{% trans %}Share with users{% endtrans %}</label>
        <p>{% trans %}Yourself{% endtrans %}</p>
        {% for group in thread.groups.all() %}
            {% if group.name.startswith('_internal_') %}
                <p>{{ group.created_by.get_profile_link() }}<p>
            {% endif %}
        {% endfor %}
        <form action="{% url share_question_with_user %}" method="post">{% csrf_token %}
            <input id="share_user_name" type="text" class="groups-input" name="recipient_name" />
            <input type="hidden" name="thread_id" value="{{ thread.id }}"/>
            <input type="submit" class="add-groups" value="{% trans %}add{% endtrans %}"/>
        </form>
        {#% if thread.groups.count() %}
            <label for="group_name">{% trans %}Shared with groups:{% endtrans %}</label>
        {% else %}
            <label for="group_name">{% trans %}Share with a group{% endtrans %}</label>
        {% endif %#}
        <label for="share_group_name">{% trans %}Share with groups{% endtrans %}</label>
        {% for group in thread.groups.all() %}
            {% if not group.name.startswith('_internal_') %}{# todo: fix this hack #}
                <p>{{ macros.user_group(group) }}</p>
            {% endif %}
        {% endfor %}
        <form action="{% url share_question_with_group %}" method="post">{% csrf_token %}
            <input id="share_group_name" type="text" class="groups-input" name="recipient_name" />
            <input type="hidden" name="thread_id" value="{{ thread.id }}"/>
            <input type="submit" class="add-groups" value="{% trans %}add{% endtrans %}"/>
        </form>
        <p style="text-align: center">{% trans %}or{% endtrans %}</p>
        <form action="{% url share_question_with_group %}" method="post">{% csrf_token %}
            <input
                type="hidden"
                name="group_name"
                value="{{ settings.GLOBAL_GROUP_NAME }}"
            />
            <input type="hidden" name="thread_id" value="{{ thread.id }}"/>
            <input 
                type="submit"
                class="add-groups add-everyone-group"
                value="{% trans %}share with everyone{% endtrans %}"
            />
        </form>

    {% else %}
        <h2>{% trans %}Public thread{% endtrans %}</h2>
        <p>{% trans site_name=settings.APP_SHORT_NAME %}This thread is public, all members of {{ site_name }} can read this page.{% endtrans %}</p>
    {% endif %}
</div>

{% if settings.SIDEBAR_QUESTION_SHOW_META %}
<div class="box statsWidget">
    <div class="clearfix"></div>
    <h2>{% trans %}Stats{% endtrans %}</h2>
    <p>
        {% trans %}Asked{% endtrans %}: <strong>{{ macros.timeago(question.added_at) }}</strong>
    </p>
    <p> 
        {% trans %}Seen{% endtrans %}: <strong>{{ thread.view_count|intcomma }} {% trans %}times{% endtrans %}</strong>
    </p>
    <p>
        {% trans %}Last updated{% endtrans %}: <strong title="{{ thread.last_activity_at }}">{{thread.last_activity_at|diff_date}}</strong>
    </p>
</div>
{% endif %}

{% if similar_threads.data and settings.SIDEBAR_QUESTION_SHOW_RELATED %}
    {#% cache 1800 "related_questions" related_questions question.id language_code %#}
    <div class="box">
        <h2>{% trans %}Related questions{% endtrans %}</h2>
        <div class="questions-related">
            {% for thread_dict in similar_threads.data() %}
            <p>
                <a href="{{ thread_dict.url }}">{{ thread_dict.title|escape }}</a>
            </p>
            {% endfor %}
        </div>
    </div>
    {#% endcache %#}
{% endif %}

<div class="box">
    {{ settings.SIDEBAR_QUESTION_FOOTER }}
</div>