summaryrefslogtreecommitdiffstats
path: root/askbot/templates/email/macros.html
blob: 77345a4523da2d93be2c7850eded96d2034c22cd (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
{% macro quoted_post(
        post = None,
        quote_level = 0,
        format = None,
        is_leaf_post = False
    )
%}
    {% spaceless %}
        {{ start_quote(quote_level) }}
            {% set author = post.author.username|escape %}
            {% if post.post_type == 'question' %}
            {% if quote_level > 0 %}
            <p style="font-size:10px; font-weight: bold;">
            {% else %}
            <p style="font-size:20px; font-weight: bold; margin: 10px 0">
            {% endif %}
                    {% if format == 'parent_subthread' %}
                        {% if is_leaf_post %}
                            {% trans %}Question by {{ author }}:{% endtrans %}
                        {% else %}
                            {% trans -%}
                                In reply to {{ author }}'s question:
                            {%- endtrans %}
                        {% endif %}
                    {% else %}
                        {% trans %}Question :{% endtrans %}
                    {% endif %}
                    {{ post.thread.title }}
            </p>
            {% if quote_level > 0 %}
            <p style="font-size:10px; font-weight: bold;">
                    {% if format != 'parent_subthread' %}
                        {% trans %}Asked by {{ author }}:{% endtrans %}
                    {% endif %}
            </p>
            {% endif %}
            {% set tag_names = post.get_tag_names() %}
            {% if tag_names %}
            <p style="font-size:10px; font-style:italic;">
                {% trans %}Tags:{% endtrans %}
                {{ tag_names|join(', ') }}.
            </p>
            {% endif %}
            {% elif post.post_type == 'answer' %}
                <p style="font-size:10px; font-weight: bold;">
                    {% if format == 'parent_subthread' %}
                        {% if is_leaf_post %}
                            {% trans -%}
                                {{ author }}'s answer:
                            {%- endtrans %}
                        {% else %}
                            {% trans -%}
                                In reply to {{ author }}'s answer:
                            {%- endtrans %}
                        {% endif %}
                    {% else %}
                        {% trans %}Answered by {{ author }}:{% endtrans %}
                    {% endif %}
                </p>
            {% else %}
                <p style="font-size:10px; font-weight: bold;">
                    {% if format == 'parent_subthread' %}
                        {% if is_leaf_post %}
                            {% trans -%}
                                {{ author }}'s comment:
                            {%- endtrans %}
                        {% else %}
                            {% trans -%}
                                In reply to {{ author }}'s comment:
                            {%- endtrans %}
                        {% endif %}
                    {% else %}
                        {% trans author -%}
                            Commented by {{ author }}:
                        {%- endtrans %}
                    {% endif %}
                </p>
            {% endif %}
            {{ post.html }}
        {{ end_quote(quote_level) }}
    {% endspaceless %}
{% endmacro %}

{% macro start_quote(level = 0) %}
    {% for number in range(level) %}
        <div style="padding-left:5px; border-left: 2px solid #aaa;">
    {% endfor %}
{% endmacro %}

{% macro end_quote(level = 0) %}
    {% for number in range(level) %}
        </div>
    {% endfor %}
{% endmacro %}

{% macro heading_style() %}
font-size:14px;font-weight:bold;margin-bottom:0px;
{% endmacro %}

{% macro fine_print_style() %}
font-size:8px;color:#aaa;margin-bottom:0px;
{% endmacro %}