<div class="form-error" id="form-error" style="display:none"></div>

{% if saved %}
  <div class="form-success">{{ "info_saved"|lang }}</div>
{% endif %}

{% if is_edit %}
  {{ bc([
    {url: "/#{short_name}/", text: "view_page"|lang},
  ], 'padding-bottom: 12px') }}
{% endif %}

<table cellpadding="0" cellspacing="0" class="blog-write-table">
  <tr>
    <td id="form_first_cell">
      <form class="blog-write-form form-layout-v" name="pageForm" action="{{ form_url }}" method="post">
        <div class="form-field-wrap clearfix">
          <div class="form-field-label">{{ "pages_write_form_title"|lang }}</div>
          <div class="form-field">
            <input class="form-field-input" type="text" name="title" value="{{ title }}" />
          </div>
        </div>

        <div class="form-field-wrap clearfix">
          <div class="form-field-label">{{ "pages_write_form_text"|lang }}</div>
          <div class="form-field">
            <textarea class="form-field-input" name="text" wrap="soft">{{ text }}</textarea><br/>
            <a class="blog-write-form-toggle-link" id="toggle_wrap" href="">{{ "pages_write_form_toggle_wrap"|lang }}</a>
          </div>
        </div>

        {% if is_edit %}
          <div class="form-field-wrap clearfix">
            <table class="blog-write-options-table">
              <tr>
                <td width="40%">
                  <div class="clearfix">
                    <div class="form-field-label">{{ "pages_write_form_short_name"|lang }}</div>
                    <div class="form-field">
                      <input class="form-field-input" type="text" name="new_short_name" value="{{ short_name }}" />
                    </div>
                  </div>
                </td>
                <td width="30%">
                  <div class="clearfix">
                    <div class="form-field-label">{{ "pages_write_form_parent"|lang }}</div>
                    <div class="form-field">
                      <input class="form-field-input" type="text" name="parent" value="{{ parent }}" />
                    </div>
                  </div>
                </td>
                <td width="30%">
                  <div class="clearfix">
                    <div class="form-field-label">{{ "pages_write_form_options"|lang }}</div>
                    <div class="form-field">
                      <label for="visible_cb">
                        <input type="checkbox"
                          id="visible_cb"
                          name="visible"
                          {% if visible %}checked="checked"{% endif %}
                        >
                          {{ "pages_write_form_visible"|lang }}
                      </label>

                      <label for="render_title_cb">
                        <input type="checkbox"
                          id="render_title_cb"
                          name="render_title"
                          {% if render_title %} checked="checked"{% endif %}
                        >
                          {{ "pages_write_form_render_title"|lang }}
                      </label>
                    </div>
                  </div>
                </td>
              </tr>
              <tr>
                <td rowspan="3">
                  <button type="submit" name="submit_btn"><b>{{ "pages_write_form_submit_btn"|lang }}</b></button>
                </td>
              </tr>
            </table>
          </div>
        {% else %}
          <div class="form-field-wrap clearfix">
            <div class="form-field-label"></div>
            <div class="form-field">
              <button type="submit" name="submit_btn"><b>{{ "pages_write_form_submit_btn"|lang }}</b></button>
            </div>
          </div>
          <input name="short_name" value="{{ short_name }}" type="hidden" />
        {% endif %}
      </form>
      <div id="form_placeholder"></div>
    </td>
    <td>
      <div class="blog-write-form-preview post_text" id="preview_html"></div>
    </td>
  </tr>
</table>

{% js %}
cur.form = new AdminWriteEditForm({{ js_params|json_encode|raw }});
{% endjs %}