{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "wiki/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% from "includes/common_macros.html" import content_editor %}
{% set title = _('Create a New Article | Knowledge Base') %}
{% block title %}{{ page_title(title) }}{% endblock %}
{# TODO: Change KB url to landing page when we have one #}
{% set crumbs = [(None, _('New Article'))] %}
{% set classes = 'new' %}
{% block bodyclass %}new{% if is_template %} is-template{% endif %}{% endblock %}

{% block content %}
<section id="content">
  <div class="wrap">
    <div id="content-main" class="full">
    <article class="article" role="main">
    {{ errorlist(document_form) }}
    {{ errorlist(revision_form) }}
    <form id="wiki-page-edit" class="editing" method="post" action="">
      <fieldset>
      <header id="article-head">
        {{ document_form.category|safe }}

        <ul class="metadata">
          <li><label>{{_('Title:')}}</label> {{ document_form.title | safe }}</li>
          <li><label>{{_('Slug:')}}</label> {{ document_form.slug | safe }}</li>
          <li><label>{{_('Tags:')}}</label> {{ revision_form.tags | safe }}</li>
        </ul>

        {% include 'wiki/includes/page_buttons.html' %}

      </header>

      {{ revision_form.content|safe }}
      {% if is_template %}
        <div id="ace_content"></div>
      {% endif %}

      <section>
        <h4>Review needed?</h4>
        {{ revision_form.review_tags|safe }}
      </section>
      
    </fieldset>
    </form>
    
    </article>
    <div id="preview"></div>
    </div>
   </div>
</section>
{% endblock %}

{% block site_js %}
    {{ super() }}

    {% if is_template %}
      <script src="{{ MEDIA_URL }}ace/ace.js" 
        type="text/javascript" charset="utf-8"></script>
      <script src="{{ MEDIA_URL }}ace/theme-dreamweaver.js"
        type="text/javascript" charset="utf-8"></script>
      <script src="{{ MEDIA_URL }}ace/mode-javascript.js"
        type="text/javascript" charset="utf-8"></script>
    {% endif %}

{% endblock %}
