summaryrefslogtreecommitdiffstats
path: root/askbot/templates/widgets/edit_post.html
blob: 810fdfb5d7b4409537c0cb9d785da4a8de052c5f (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
{% if editor_type == 'markdown' %}
    <div class="wmd-container">
        <div id="wmd-button-bar" class="wmd-panel"></div>
        {{ post_form.text }}{# this element is resizable and will be wrapped by js #}
    </div>
{% else %}
    <div class="wmd-container">
        {{ post_form.media }}
        {{ post_form.text }}
    </div>
    <script type="text/javascript">
        {% if post_html %}
            askbot['data']['editorContent'] = '{{ post_html|escapejs }}';
        {% endif %}
    </script>
{% endif %}
<div class="form-item">
    <label for="editor" class="form-error">{{ post_form.text.errors }}</label>
    <p class="editor-status action-status"><span></span></p>
</div>
{# need label element for resizable input, b/c form validation won't find span #}
{% if post_type == 'question' %}
    <div class="form-item question-tags">
        {% if use_category_selector %}
            {% include "widgets/three_column_category_selector.html" %}
            <div class="tags-desc">{% trans %}Tags{% endtrans %}</div>
            {% include "widgets/tag_editor.html" %}
        {% else %}
            {% if tags_are_required %}
                <label for="id_tags">
                {% if mandatory_tags %}
                    <strong>{% trans %}tags{% endtrans %}</strong>
                    {% trans %}, one of these is required{% endtrans %}
                    {{
                        tag_list_widget(
                            mandatory_tags,
                            make_links = False,
                            css_class = 'clearfix'
                        )
                    }}
                {% else %}
                    <strong>{% trans %}tags:{% endtrans %}</strong> 
                    {% trans %}(required){% endtrans %}
                {% endif %}
                </label>
            {% else %}
                <strong>{% trans %}tags:{% endtrans %}</strong>
            {% endif %}
            <span class="form-error">{{ post_form.tags.errors }}</span><br/>
            {{ post_form.tags }}
            <br/><label for="id_tags">{{ post_form.tags.help_text }}</label>
        {% endif %}
    </div>
{% endif %}
{#% if 'summary' in post_form['fields'] %}
    <!-- todo: either remove this field or make it folded by default -->
    <div class="form-item revision-comment">
        <strong>{{ post_form.summary.label_tag() }}</strong> <br/>
        {{ post_form.summary }}
        <div class="title-desc">
            {{ post_form.summary.help_text }}
        </div>
        <div class="form-error" >{{ post_form.summary.errors }}</div>
    </div>
{% endif %#}

{% if editor_type == 'markdown' %}
    <div class="preview-toggle">
        <span 
            id="pre-collapse" 
            title="{% trans %}Toggle the real time Markdown editor preview{% endtrans %}"
        >
            [{% trans %}hide preview{% endtrans %}]
        </span>
    </div>
    <div class="clearfix"></div>
    <div id="previewer" class="wmd-preview"></div>
{% endif %}

{% if user and user.is_authenticated() and user.is_administrator() %}
    {# admin can post answers or questions on behalf of anyone. #}
    <table class="proxy-user-info">
        <tbody>
            <tr><td colspan="2">
                <label>
                    {% trans %}To post on behalf of someone else, enter user name <strong>and</strong> email below.{% endtrans %}
                </label>
            </td></tr>
            <tr>
                <td>
                    <div class="form-item">
                        {{ post_form.post_author_username }}
                    </div>
                    <div class="form-item">
                        {{ post_form.post_author_email }}
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <span class="form-error">{{ post_form.post_author_username.errors }}</span>
                    <span class="form-error">{{ post_form.post_author_email.errors }}</span>
                </td>
        </tbody>
    </table>
{% endif %}