src/catedit/templates/categories/workshop.html
author durandn
Tue, 24 Mar 2015 13:12:59 +0100
changeset 56 ae469e83026f
parent 47 ddba4624d661
child 59 54eb90122a72
permissions -rw-r--r--
Fixed errors when submitting (Github api sends tuples for commit parents now) + Fixed error when editing (session entry for modified and deleted categories didn't initialize properly) + added back links to workshop page on discussion list and changeset list

{% extends "layout.html" %}
{% if not session["user_logged"] or not session["user_can_edit"][current_repository] %}
  {% set readonly="readonly" %}
{% else %}
  {% set readonly=False %}
{% endif %}
{% block title %}{{current_repository}}: Atelier{% endblock title %}
{% block head %}
  {{ super() }}
  <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}" language="Javascript" type="text/javascript"></script>
  <script>
    $(document).ready(function(){
      $(".cat-delete-div").hide();
      $(".cat-info-div").hide();
      $(".cat-table-toggle").click(function(evt){
        $(".cat-table").slideToggle(function(){
          $(".cat-table-toggle").children().toggleClass("glyphicon-chevron-up");
          $(".cat-table-toggle").children().toggleClass("glyphicon-chevron-down");
        });
      });
      $(".cat-delete-toggle").click(function(evt){
        $("#delete_confirm_"+evt.target.id.split('_').slice(2,5).join('_')).slideToggle();
      });
      $(".cat-info-toggle").click(function(evt){
        $("#properties_"+evt.target.id.split('_').slice(2,5).join('_')).slideToggle(function(){
          $("#info_button_"+evt.target.id.split('_').slice(2,5).join('_')).children().toggleClass("glyphicon-plus-sign");
          $("#info_button_"+evt.target.id.split('_').slice(2,5).join('_')).children().toggleClass("glyphicon-minus-sign");
        });
      });
    });
  </script>
{% endblock head %}
{% block navbar_items %}
  {{ super() }}
  {% if session.get("user_logged", None) %}
    <li><a class="navbar-decorative">></a></li>
    <li class="active"><a>{{current_repository}}</a></li>
  {% endif %}
{% endblock navbar_items %}
{% block repo_list %}
  {{ super() }}
{% endblock repo_list %}
{% block page_content %}
  <h2> <b>CatEdit</b> - <small>{{current_repository}}</small></h2>
  {% if session["user_logged"] and not session["user_can_edit"] %}
  <div class="alert alert-warning" role="alert">
    <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
    <span class="sr-only">Attention:</span>
    Vous n'avez pas accès en écriture au repository contenant les catégories - Vous ne pourrez pas les modifier.
  </div>
  {% endif %}
  <h3>Mes catégories <a title="Afficher/Cacher tableau" class="btn btn-default cat-table-toggle">
    <span class="glyphicon glyphicon-chevron-up"/>
  </a></h3>
  <div class="cat-table">
    <table class="table table-bordered table-condensed">
      <thead>
        <tr class="active">
          <th class="col-md-2"><b>Nom de la catégorie</b></th>
          <th class="col-md-10" colspan="5"><b>Description de la catégorie</b></th>
        </tr>
      </thead>
      <tbody>
      {% if not session["user_logged"] %}
      <tr>
        <td class="col-md-12" colspan="5">
          <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
          <span class="sr-only">Attention:</span>
          Veuillez vous identifier pour visualiser les catégories
        </td>
      </tr>
      {% else %}
        {% if cat_list|length == 0 %}
          <tr>
            <td class="col-md-12" colspan="2">Aucune catégorie n'a été créée pour l'instant. {% if not readonly %}<a href="{{ url_for('categories.editor', repository=current_repository) }}">Créer une catégorie</a>{% endif %}</td>
          </tr>
        {% else %}
          {% import "macros.html" as macros %}
          {{ macros.category_table(cat_list, current_repository, target="categories.workshop") }}
        {% endif %}
      {% endif %}
      </tbody>
    </table>
  </div>
  <h4> Créer une catégorie : <a href="{{url_for('categories.editor', repository=current_repository)}}" title="Créer catégorie" class="btn btn-default {% if readonly %}disabled{% endif %}"><span class="glyphicon glyphicon-plus"/></a></h4>
  {% if session.get("user_logged") %}
  <form method="POST" action="{{url_for('categories.workshop', repository=current_repository)}}" class="form-inline">
    <input name="csrf_token" value="{{ csrf_token() }}" type="hidden">
    <h4> Annuler tous mes changements actuels :
      <a title="Supprimer changements">
        <button type="submit" class="btn btn-default" {% if readonly %}disabled{% endif %}>
          <span class="glyphicon glyphicon-remove"/>
        </button>
      </a>
    </h4>
  </form>
  <h4> Soumettre mes changements actuels : <a href="{{ url_for('categories.submit', repository=current_repository)}}" title="Soumettre changements" class="btn btn-default" {% if readonly %}disabled{% endif %}><span class="glyphicon glyphicon-share"/></a>
  </h4>
  {% endif %}
  <h3>Modifications récentes</h3>
  <table class="table table-condensed">
    <thead>
      <tr>
        <th>Auteur</th>
        <th>Date</th>
        <th>Message de soumission</th>
        <th>Commentaires</th>
      </tr>
    </thead>
    <tbody>
      {% if not changeset_list %}
        <tr>
          <td colspan="5">
            Il n'y a aucune modification à afficher.
          </td>
        </tr>
      {% else %}
        {% for changeset in changeset_list %}
          <tr>
            <td class="col-md-1">{{changeset["author"]}}</td>
            <td class="col-md-2">{{changeset["date"]}}</td>
            <td class="col-md-6">{{changeset["title"]}}</td>
            <td class="col-md-2">{{changeset["comment_count"]}}</td>
            <td class="col-md-1">
              <a href="{{ url_for('social.changeset', repository=current_repository, changeset_id=changeset['id'])}}" title="Voir modifications" class="btn btn-default">
                <span class=" glyphicon glyphicon-log-in"/>
              </a>
            </td>
          </tr>
        {% endfor %}
      {% endif %}
    </tbody>
  </table>
  <h4>Voir la liste des modifications: <a href="{{ url_for('social.changesets_index', repository=current_repository)}}" title="Voir la liste complète" class="btn btn-default"><span class="glyphicon glyphicon-comment"/></a>
  </h4>
  <h3>Discussions récentes</h3>
  <table class="table table-condensed">
    <thead>
      <tr>
        <th>Auteur</th>
        <th>Date</th>
        <th>Titre</th>
        <th>Commentaires</th>
        <th>Dernier commentaire</th>
      </tr>
    </thead>
    <tbody>
  {% if not discussion_list %}
    <tr>
      <td colspan="5">
        Il n'y a de discussion à afficher pour cette ensemble de catégories. <a href="{{ url_for('social.discussion', repository=current_repository, discussion_id='new')}}">Créer une discussion</a>
      </td>
    </tr>
  {% else %}
    {% for discussion in discussion_list %}
      <tr>
        <td class="col-md-1">{{discussion["author"]}}</td>
        <td class="col-md-2">{{discussion["opening_date"]}}</td>
        <td class="col-md-5">{{discussion["title"]}}</td>
        <td class="col-md-1">{{discussion["comment_count"]}}</td>
        <td class="col-md-2">{{discussion["last_updated"]}}</td>
        <td class="col-md-1">
          <a href="{{ url_for('social.discussion', repository=current_repository, discussion_id=discussion['id'])}}" title="Voir la discussion" class="btn btn-default">
            <span class=" glyphicon glyphicon-log-in"/>
          </a>
        </td>
      </tr>
    {% endfor %}
  {% endif %}
    </tbody>
  </table>
  <h4>Voir la liste des discussions: <a href="{{ url_for('social.discussions_index', repository=current_repository)}}" title="Voir la liste complète" class="btn btn-default"><span class="glyphicon glyphicon-comment"/></a>
{% endblock page_content %}