<form id="page-form" action="<%== @form_action %>" method="post">
  <fieldset class="default">
    <div class="field">
      <label for="name">Name</label>
      <input type="text" name="name" id="name" class="name-page"
          maxlength="64" value="<%== @page ? @page.name : '' %>" />

      <% if @page; @page.errors.on(:name).each do |error| %>
        <p class="flash error"><%== error %></p>
      <% end; end %>
    </div>

    <div class="field">
      <label for="title">Title</label>
      <input type="text" name="title" id="title" class="title-page"
          maxlength="255" value="<%== @page ? @page.title : '' %>" />

      <% if @page; @page.errors.on(:title).each do |error| %>
        <p class="flash error"><%== error %></p>
      <% end; end %>
    </div>

    <div class="field">
      <label for="body">Body</label>
      <textarea name="body" id="body" rows="15" cols="60"><%== @page ? @page.body : '' %></textarea>

      <% if @page; @page.errors.on(:body).each do |error| %>
        <p class="flash error"><%== error %></p>
      <% end; end %>
    </div>
  </fieldset>

  <p class="buttons">
    <input type="hidden" name="token" value="<%== form_token %>" />
    <input type="submit" name="action" value="Preview" />
    <input type="submit" name="action" value="Post" />
  </p>
</form>

<h3>Hey, look! Tips!</h3>

<ul class="tips">
  <li>
    Use
    <a href="http://redcloth.org/textile" target="_blank">Textile</a>
    or XHTML for formatting.
  </li>
  <li>
    To link to another page on this site, use wiki-style links like
    <kbd>[[pagename]]</kbd> or <kbd>[[pagename|link text]]</kbd>.
  </li>
  <li>
    To link to a blog post, use a link like
    <kbd>[[@postname_or_id]]</kbd> or
    <kbd>[[@postname_or_id|link text]]</kbd>.
  </li>
</ul>
