{% extends "layout.html" %}
{% block body %}

<div class="row">
  <div class="span11 well">
    <form action="{{ url_for('edit_project', projectid=project.id) }}" method="post" class="form-horizontal">
      <fieldset><legend>Édition du projet {{ project.name }}</legend>
        <div class="control-group">
          <label class="control-label" for="name">Nom complet</label>
          <div class="controls">
            <input type="text" name="name" id="name" value="{{ project.name }}" />
            <span class="help-inline"><font color="red">*</font> &nbsp; Exemple : French Data Network</span>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="shortname">Nom court</label>
          <div class="controls">
            <input type="text" name="shortname" id="shortname" value="{{ project.shortname }}" />
            <span class="help-inline"><font color="red">*</font> &nbsp; Exemple :  FDN</span>
            <span class="help-block">Si le nom court et le même que le nom complet, mettez simplement la même chose.</span>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="description">Description</label>
          <div class="controls">
            <input type="text" name="description" id="description" value="{{ project.description }}" />
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="website">Website</label>
          <div class="controls">
            <input type="text" name="website" id="website" value="{{ project.website }}" />
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="email">Email</label>
          <div class="controls">
            <input type="text" name="email" id="email" value="{{ project.email }}" />
            <span class="help-block">Email de contact du projet. N'hésitez pas à utiliser des [at] au lieu de @, pour éviter le spam.</span>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="irc">IRC</label>
          <div class="controls">
            Chan <input class="span2" type="text" name="irc_channel" id="irc_channel" value="{{ project.irc_channel }}" />
            sur <input class="span2" type="text" name="irc_server" id="irc_server" value="{{ project.irc_server }}" />
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="zone">Zone</label>
          <div class="controls">
            <input type="text" name="zone" id="zone" value="{{ project.zone }}" />
            <span class="help-block">Zone (région, département, ville, village…) concernée par le FAI.</span>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="gps">Coordonnées GPS</label>
          <div class="controls">
            <div class="input-append input-prepend">
              <input class="span2" type="text" name="gps1" id="gps1" value="{{ project.gps | gpspart(1) }}" />
              <span class="add-on">:</span>
              <input class="span2" type="text" name="gps2" id="gps2" value="{{ project.gps | gpspart(2) }}" />
            </div>
            <span class="help-block">Coordonnées GPS du siège social ou du point de rencontre habituel, pour la carte</span>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="step">Étape</label>
          <div class="controls">
            <select name="step" id="step">
              {% for i in range(1, 8) %}
              {% if i == project.step %}
              <option selected>{{ i }} - {{ i | stepname }}</option>
              {% else %}
              <option>{{ i }} - {{ i | stepname }}</option>
              {% endif %}
              {% endfor %}
            </select>
          </div>
        </div>
        <div class="control-group">
          <label class="control-label" for="is_member">Membre</label>
          <div class="controls">
            <label class="checkbox">
              <input type="checkbox" name="is_member" {% if project.is_member == 1 %} checked {% endif %}/> 
              Ce FAI est-il membre de la Fédération FDN ?
            </label>
          </div>
        </div>
        
        <div class="form-actions">
          <input type="submit" class="btn btn-primary" value="Enregistrer" />
          <input type="reset" class="btn" value="Annuler" />
        </div>
      </fieldset>
    </form>
  </div>

  <div class="span11 well">
    <fieldset><legend>Documents</legend>
      <table class="table table-stripped table-condensed">
        <thead>
          <tr>
            <th>Nom</th>
            <th>Lien
            <th>Actions
          </tr>
        </thead>
        <tbody>
        {% for attachment in attachments %}
          <tr>
            <td>{{ attachment.name }}</td>
            <td>{{ attachment.url }}</td>
            <td><a href="" class="btn btn-small btn-danger">Supprimer</a></td>
          </tr>
        {% endfor %}
        </tbody>
        <tfoot>
          <tr>
            <form action="" method="post">
              <td><input type="text" name="name" value="Nouveau document" 
                onfocus="if(this.value=='Nouveau document')this.value='';"
                onblur="if(this.value=='')this.value='Nouveau document';" /></td>
              <td><input type="text" name="url" value="http://…" 
                onfocus="if(this.value=='http://…')this.value='';"
                onblur="if(this.value=='')this.value='http://…';" /></td>
              <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
            </form>
          </tr>
        </tfoot>
      </table>
    </fieldset>
  </div>

</div>

{% endblock %}