<commit_before>{% extends "layout.html" %}

{% block title %}- Documents{% endblock title %}

{% block head %}
<script>
  function toggle_info(elmt) {
      $('ul#' + elmt).toggle();
  }
  function search_document(document_name) {
      // Remove results if exist
      $('#search-results').remove();

      // If no search
      if(document_name.length == 0) {
        return false;
      }
      
      var documents = [];
      var index = [];
      document_name = document_name.toLowerCase();
      
      // Get the documents called like the search value
      $.each($('h4>a'), function () {
          index.push($(this).html().toLowerCase().indexOf(document_name));
      });
      $.each(index, function(i, val) {
          if(val != -1) {
              documents.push($('h4').eq(i).html());
          } 
      });
      
      // Display the results
      if(documents.length>0) {
          
          var list = $('<ul>', {'id': 'search-results'}).html('');
          $.each(documents, function(i, val) {
              var li = $('<li>').html(val);
              list.append(li);
          });    
      } else {
          var list = $('<ul>', {'id': 'search-results'});
          list.append('<li>Pas de résultats</li>');
      }
      $('#doc-list').before(list);      
  }
</script>
{% endblock head %}

{% block content %}
  <h2>Documents enregistrés</h2>
  <input type="text" name="search" placeholder="Rechercher une archive" title="Rechercher une archive" oninput="return search_document($(this).val())"/>
  <ul id="doc-list">
  {% for cls in document_classes %}
    {% set ids = cls.list_document_ids()|sort %}
    {% if ids|length > 0 %}
      <li><h3>{{ cls.type_name.capitalize() }}</h3>
        <ul>
          {% for document_id in ids %}
            {% set history = (cls(document_id).history | list)[:-1] %}
            <li>
              <h4><a href="{{ url_for('edit', document_type=cls.type_name, document_name=document_id) }}">{{ document_id }}</a></h4>
              <ul>
                {% for version in history %}
                  <li>
                    <a href="{{ url_for('edit', document_type=cls.type_name, document_name=document_id, version=version.version) }}">{{ version.datetime|local_time|strftime("Le %d %B %Y à %H:%M") }}</a> 
                    <a href="javascript:toggle_info('{{ version.version[:7] }}')" class="details">+ détails</a>
                    <ul id="{{ version.version[:7] }}" class="document-info">
                      <li>{{ version.message }}</li>
                      <li>{{ version.author }}</li>
                    </ul>
                  </li>
                {% endfor %}
              </ul>
            </li>
          {% endfor %}
        </ul>
      </li>
    {% endif %}
  {% endfor %}
  </ul>
  </div>
{% endblock content %}<commit_msg>Fix .git bug on documents<commit_after>{% extends "layout.html" %}

{% block title %}- Documents{% endblock title %}

{% block head %}
<script>
  function toggle_info(elmt) {
      $('ul#' + elmt).toggle();
  }
  function search_document(document_name) {
      // Remove results if exist
      $('#search-results').remove();

      // If no search
      if(document_name.length == 0) {
        return false;
      }
      
      var documents = [];
      var index = [];
      document_name = document_name.toLowerCase();
      
      // Get the documents called like the search value
      $.each($('h4>a'), function () {
          index.push($(this).html().toLowerCase().indexOf(document_name));
      });
      $.each(index, function(i, val) {
          if(val != -1) {
              documents.push($('h4').eq(i).html());
          } 
      });
      
      // Display the results
      if(documents.length>0) {
          
          var list = $('<ul>', {'id': 'search-results'}).html('');
          $.each(documents, function(i, val) {
              var li = $('<li>').html(val);
              list.append(li);
          });    
      } else {
          var list = $('<ul>', {'id': 'search-results'});
          list.append('<li>Pas de résultats</li>');
      }
      $('#doc-list').before(list);      
  }
</script>
{% endblock head %}

{% block content %}
  <h2>Documents enregistrés</h2>
  <input type="text" name="search" placeholder="Rechercher une archive" title="Rechercher une archive" oninput="return search_document($(this).val())"/>
  <ul id="doc-list">
  {% for cls in document_classes %}
    {% set ids = cls.list_document_ids()|sort %}
    {% if ids|length > 0 %}
      <li><h3>{{ cls.type_name.capitalize() }}</h3>
        <ul>
          {% for document_id in ids %}
            {% set history = (cls(document_id).history | list)[:-1] %}
            <li>
              <h4><a href="{{ url_for('edit', document_type=cls.type_name, document_name=document_id) }}">{{ document_id }}</a></h4>
              <ul>
                {% for version in history %}
                  <li>
                    <a href="{{ url_for('view', document_type=cls.type_name, document_name=document_id, version=version.version) }}">{{ version.datetime|local_time|strftime("Le %d %B %Y à %H:%M") }}</a> 
                    <a href="javascript:toggle_info('{{ version.version[:7] }}')" class="details">+ détails</a>
                    <ul id="{{ version.version[:7] }}" class="document-info">
                      <li>{{ version.message }}</li>
                      <li>{{ version.author }}</li>
                    </ul>
                  </li>
                {% endfor %}
              </ul>
            </li>
          {% endfor %}
        </ul>
      </li>
    {% endif %}
  {% endfor %}
  </ul>
  </div>
{% endblock content %}
{'fraction_non_alphanumeric': 0.1904002833864683, 'fraction_numerical': 0.005313496280552604, 'mean_word_length': 1.9228778467908902, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2344648', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1709, 'n_words': 356}