{% extends "wiki/article.html" %}
{% load wiki_tags i18n %}
{% load url from future %}

{% block pagetitle %}{% trans "Edit" %}: {{ article.current_revision.title }}{% endblock %}

{% block wiki_contents_tab %}

<form method="POST" class="form-horizontal" id="article_edit_form" enctype="multipart/form-data">
  {% include "wiki/includes/editor.html" %}
  <div class="form-actions">
      <button type="submit" name="save" value="1" class="btn btn-large btn-primary" onclick="this.form.target=''; this.form.action='{% url 'wiki:edit' path=urlpath.path article_id=article.id %}'">
        <span class="icon-ok"></span>
        {% trans "Save changes" %}
      </button>
      <button type="submit" name="preview" value="1" class="btn btn-large" onclick="$('#previewModal').modal('show'); this.form.target = 'previewWindow'; this.form.action = '{% url 'wiki:preview' path=urlpath.path article_id=article.id %}';">
        <span class="icon-eye-open"></span>
        {% trans "Preview" %}
      </button>
      
      <a href="{% url 'wiki:delete' path=urlpath.path article_id=article.id %}" class="pull-right btn btn-danger">
        <span class="icon-trash"></span>
        {% trans "Delete article" %}
      </a>
      
  </div>
  <div class="modal hide fade" id="previewModal">
    <div class="modal-body">
      <iframe name="previewWindow" frameborder="0"></iframe>
    </div>
    <div class="modal-footer">
      <button type="submit" name="save" value="1" class="btn btn-large btn-primary" onclick="this.form.target=''; this.form.action='{% url 'wiki:edit' path=urlpath.path article_id=article.id %}'">
        <span class="icon-ok"></span>
        {% trans "Save changes" %}
      </button>

      <a href="#" class="btn btn-large" data-dismiss="modal">
        <span class="icon-circle-arrow-left"></span>
        {% trans "Back to editor" %}
      </a>
    </div>
  </div>
</form>

{% endblock %}

