<div class="modal fade" id="modal-upload-new-version" role="dialog"
    data-keyboard="true">
  <div class="modal-dialog">
    <div class="modal-content">

      <form id="fileupload"
          action="{{ url_for(".document_upload", doc_id=doc.id, community_id=doc.community.slug) }}"
          method="POST" enctype="multipart/form-data">
        {{ csrf_token }}

        <div class="modal-header">
          <button class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ _("Upload new version") }}</h4>
        </div>

        <div class="modal-body">
          <div class="form-group">
            <input type="file" name="file"/>
          </div>
          {# Doesn't work currently.
            <div class="fileupload fileupload-new" data-fileupload="file">
            <div class="fileupload-preview uneditable-input span5"></div>
            <span class="btn btn-file"><span class="fileupload-new">{{ _("Select file") }}</span><span class="fileupload-exists">{{ _("Change") }}</span></span>
            <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">{{ _("Remove") }}</a>
            </div>
            #}
        </div>

        <div class="modal-footer">
          <button data-dismiss="modal" class="btn">{{ _("Cancel") }}</button>
          <button class="btn btn-primary"
              type="submit">{{ _("Upload") }}</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div class="modal fade" id="modal-send-by-email" role="dialog"
    data-keyboard="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <form
          action="{{ url_for(".document_send", doc_id=doc.id, community_id=doc.community.slug) }}"
          method="POST">
        {{ csrf_token }}

        <div class="modal-header">
          <button class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ _("Send by email") }}</h4>
        </div>

        <div class="modal-body">
          <div class="form-group">
            <label class="control-label">{{ _("Recipient") }}</label>

            <div class="input-group">
              <span class="input-group-addon">@</span>
              <input class="form-control" id="prependedInput"
                  type="text" name="recipient"
                  value="{{ request.args.get('recipient', '') }} "/>
            </div>
          </div>

          <div class="form-group">
            <label class="control-label">{{ _("Message") }}</label>
            <textarea name="message"
                class="form-control resizeable-vertical" rows="6"
                placeholder="{{ _('Message...') }}">{{ request.args.get('message', '') }}</textarea>
          </div>
        </div>

        <div class="modal-footer">
          <button data-dismiss="modal" class="btn">{{ _("Cancel") }}</button>
          <button class="btn btn-primary" type="submit">{{ _("Send") }}</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div class="modal fade" id="modal-delete" role="dialog" data-keyboard="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <form
          action="{{ url_for(".document_delete", doc_id=doc.id, community_id=doc.community.slug) }}"
          method="POST">
        {{ csrf_token }}

        <div class="modal-header">
          <button class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ _("Delete File") }}</h4>
        </div>

        <div class="modal-body">
          {{ _('Are you sure you want to delete the file "{filename}" ?').format(filename=doc.title) }}
        </div>

        <div class="modal-footer">
          <button data-dismiss="modal" class="btn">{{ _("Cancel") }}</button>
          <button type="submit"
              class="btn btn-danger">{{ _("Really Delete") }}</button>
        </div>
      </form>
    </div>
  </div>
</div>

<div class="modal fade" id="modal-edit" role="dialog" data-keyboard="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <form method="POST"
          action="{{ url_for(".document_edit", doc_id=doc.id, community_id=doc.community.slug) }}"
          enctype="multipart/form-data">

        {{ csrf_token }}

        <div class="modal-header">
          <button class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">{{ _("Edit document properties") }}</h4>
        </div>

        <div class="modal-body">
          <div class="form-group">
            <label class="control-label" for="inputName">{{ _("Name") }}</label>

            <input type="text" class="form-control" id="inputName" name="title"
                value="{{ doc.title }}">
            <span class="help-block hide"></span>
          </div>

          <div class="form-group">
            <label class="control-label"
                for="inputDescription">{{ _("Description") }}</label>

              <textarea class="form-control resizeable-vertical" rows="5"
                  cols="80" id="inputDescription"
                  name="description">{{ doc.description }}</textarea>
          </div>
        </div>

        <div class="modal-footer">
          <button data-dismiss="modal" class="btn">{{ _("Cancel") }}</button>
          <button class="btn btn-primary" type="submit" name="action"
              value="edit">{{ _("Save changes") }}</button>
        </div>
      </form>
    </div>
  </div>
</div>
