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

{% if not post_html %}
{# uploading a file is only possible when contributing a new question or
   answer, not when editing one. #}
<div class="form-item upload-attached-file">
   <label for="attached-file">Joindre un fichier</label>
   <input name="attached-file" type="file"/>
   <p>
     Vous pouvez également joindre un fichier à votre contribution. Les
     fichiers utilisables sont les formulaires, les workflows, ainsi que les
     thèmes graphiques.
   </p>
</div>
{% endif %}

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