<tal:block tal:define="notes view/notes_view/get_notes;
                       note_exists python: bool([n for n in notes if n])">
  <form method="post"
        tal:condition="python: note_exists or view.is_add_mode"
        tal:define="note_title view/get_note_title"
        tal:attributes="action view/get_form_action">

    <tal:block tal:condition="python: view.is_add_mode or view.is_edit_mode">     
      <div tal:attributes="class python: view.class_for_field('title')">
        <label for="title">Title</label>
        <div class="error_msg"
             tal:condition="view/errors/title|nothing"
             tal:content="view/errors/title" />
        <input type="text"
               name="title"
               tal:attributes="value note_title" />
      </div>
    </tal:block>

    <tal:block tal:condition="python: 'delete' in view.modes and view.is_delete_mode">
      <p>Are you sure you want to delete this note ?</p>

      <p class="discreet"
         tal:content="note_title" />
    </tal:block>

    <tal:block tal:condition="python: 'display' in view.modes and view.is_display_mode">
      <p>Set where the note should be displayed</p>
      <ul tal:define="zones view/get_zones">
        <li tal:repeat="zone zones">
          <label>
            <input type="checkbox"
                   name="zones"
                   tal:attributes="checked python: zone['checked'] and 'checked' or None;
                                   value zone/value" />
            <span tal:replace="zone/value" />
          </label>
        </li>
      </ul>
    </tal:block>


    <input type="hidden"
           name="obj_id"
           tal:define="obj_id view/current_object_id"
           tal:condition="obj_id"
           tal:attributes="value obj_id" />

    <span tal:replace="structure view/make_form_extras" />
  </form>

  <p tal:condition="not: python: note_exists or view.is_add_mode">
    There is no note to manage, click the '+' button to create a new one.
  </p>
</tal:block>