summaryrefslogtreecommitdiffstats
path: root/askbot/templates/question/sidebar.html
blob: c4301b6cb6ab5c442b1736b9749f7e2027884cb3 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{% import "macros.html" as macros %}
{% if 'SIDEBAR_QUESTION_HEADER'|show_block_to(request.user) %}
<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 settings.RSS_ENABLED %}
        <p class="rss">
            <a
                href="{{ base_url }}/feeds/question/{{ question.id }}"
                title="{% trans %}subscribe to this question rss feed{% endtrans %}"
                >{% trans %}subscribe to rss feed{% endtrans %}</a>
        </p>
        {% endif %}
    </div> 
</div>

<div class="clearfix"></div>
{% if settings.GROUPS_ENABLED %}
<div class="box sharing-widget">
    {% if thread.is_private() %}
        <h2>{% trans %}Invite{% endtrans %}</h2>
        <p style="margin: 16px 0"
        >Invite others to help answer this question</p>
        <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>
        <p class="share-input-col">{% trans %}- or -{% endtrans %}</p>
        <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 class="share-input-col">{% trans %}- or -{% endtrans %}</p>
        <form action="{% url share_question_with_group %}" method="post">{% csrf_token %}
            <input
                type="hidden"
                name="recipient_name"
                value="{{ settings.GLOBAL_GROUP_NAME }}"
            />
            <input type="hidden" name="thread_id" value="{{ thread.id }}"/>
            <p class="share-input-col">
            <input 
                type="submit"
                class="add-groups add-everyone-group"
                value="{% trans %}share with everyone{% endtrans %}"
            />
            </p>
        </form>

        {% set shared_users_count = sharing_info['users'].count() %}
        {% set shared_groups_count = sharing_info['groups'].count() %}

        {% if shared_users_count or shared_groups_count %}
            <p 
                style="margin:16px 0 4px 0"
            >{% trans %}This question is currently shared only with:{% endtrans %}</p>
        {% endif %}
        <h3>{% trans %}Individual users{% endtrans %}</h3>
            {% set comma = joiner(',') %}
            {{ comma() }}
        <p>
        <a href="{{ request.user.get_profile_url() }}">
            {% trans %}You{% endtrans -%}
        </a>{%- if shared_users_count -%}
                {%- for user in sharing_info['users'] %}{{ comma() }}
                    {{ user.get_profile_link() }}
                {%- endfor -%}
            {% endif -%}
            {%- if sharing_info['more_users_count'] > 0 %}
                {% trans %}and{% endtrans %}
                <a 
                    class="see-related-users"
                    data-url="{% url get_thread_shared_users %}"
                    data-thread-id="{{ thread.id }}"
                >{% trans 
                        more_count=sharing_info['more_users_count'] 
                    %}{{ more_count }} more{% endtrans %}
                </a>
            {% endif %}
        </p>

        {% if shared_groups_count %}
            <h3>{% trans %}Groups{% endtrans %}</h3>
            <p>
                {% set comma = joiner(',') %}
                {%- for group in sharing_info['groups'] -%}{{ comma() }}
                    {{ macros.user_group_link(group) }}
                {%- endfor -%}
                {% if sharing_info['more_groups_count'] > 0 %}
                    {% trans %}and{% endtrans %}
                    <a 
                        class="see-related-groups"
                        data-url="{% url get_thread_shared_groups %}"
                        data-thread-id="{{ thread.id }}"
                    >{% trans more_count=sharing_info['more_groups_count'] %}{{ more_count }} more{% endtrans %}
                    </a>
                {% endif %}
            </p>
        {% endif %}
    {% 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>
{% endif %}

{% 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 %}

{% if 'SIDEBAR_QUESTION_FOOTER'|show_block_to(request.user) %}
    <div class="box">
        {{ settings.SIDEBAR_QUESTION_FOOTER }}
    </div>
{% endif %}