changes order in tables, fixes statistiques views navbar titles
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
{% load bootstrap4 notes %}
|
||||
|
||||
{% block page_content %}
|
||||
<div class="col-lg-12">
|
||||
{% block top_block %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row d-flex">
|
||||
<div class="col-lg-7 col-md-12">
|
||||
{% block pagination %}{% endblock %}
|
||||
<table class="table table-bordered">
|
||||
{% for note in notes %}
|
||||
{% if maraude %}
|
||||
@@ -12,7 +18,6 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% block pagination %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-5 col-md-12">
|
||||
|
||||
@@ -29,13 +29,12 @@
|
||||
</nav>
|
||||
{% endblock %}
|
||||
|
||||
{% block right_column %}
|
||||
<div class="card ml-auto position-fixed">
|
||||
<h6 class="card-header">Informations</h6>
|
||||
<div class="card-body">
|
||||
<p><strong>Maraudeurs :</strong> {{ maraude.binome }} & {{ maraude.referent }}</p>
|
||||
<p><strong>Nombre de rencontres</strong> {{ maraude.rencontres.count }}</p>
|
||||
<p><strong>Nombre de personnes rencontrées</strong> {{ maraude.observations_count }}</p>
|
||||
</div>
|
||||
{% block top_block %}
|
||||
<div class="card card-body p-1 mb-2 text-center">
|
||||
<p class="card-text">
|
||||
<strong>avec {{ maraude.binome }} & {{ maraude.referent }}</strong>
|
||||
<span class="badge badge-primary ml-2">{{ maraude.rencontres.count }} rencontres</span>
|
||||
<span class="badge badge-primary ml-2">{{ maraude.observations_count }} personnes rencontrées</span>
|
||||
</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
<h6 class="navbar-text text-white my-2">{{ sujet }}</h6>
|
||||
{% endblock %}
|
||||
|
||||
{% block top_block %}
|
||||
<div class="card card-body p-1 mb-2">
|
||||
{% include "notes/details_sujet_inner.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block pagination %}
|
||||
<div class="d-flex justify-content-center">
|
||||
{% if notes.has_other_pages %}<ul class="pagination">
|
||||
@@ -20,11 +26,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block right_column %}
|
||||
<div class="card">
|
||||
<h6 class="card-header">Informations</h6>
|
||||
{% include "notes/details_sujet_inner.html" %}
|
||||
</div>
|
||||
|
||||
<div class="card mt-2">
|
||||
<h6 class="card-header">Statistiques</h6>
|
||||
<div id="stats-content">
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
{% block title %}Statistiques >{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<li><a href="{% url "statistiques:index" %}">Statistiques</a></li>
|
||||
<h6 class="navbar-text text-white my-2">Statistiques</h6>
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
{% extends "statistiques/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ block.super }} Maraudes{% endblock %}
|
||||
|
||||
|
||||
{% block sidebar %}
|
||||
{{ block.super }}
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-body text-right">
|
||||
{% include "statistiques/filter_form.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
<li>Fréquentation</li>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
{{ rencontres_par_heure.as_html }}
|
||||
{{ rencontres_par_mois.as_html }}
|
||||
<hr />
|
||||
{{ rencontres_par_sujet.as_html }}
|
||||
|
||||
{% endblock %}
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
{% block title %}{{ block.super }} Maraudes{% endblock %}
|
||||
|
||||
|
||||
{% block sidebar %}
|
||||
{{ block.super }}
|
||||
{% include "statistiques/filter_form.html" %}
|
||||
@@ -11,7 +10,7 @@
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
<li>Données générales</li>
|
||||
<p class="navbar-text my-2 ml-2">Données générales</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{block.super}}
|
||||
<li>{{page_title}}</li>
|
||||
{% if active %}<li>{{active}}</li>{% endif %}
|
||||
<p class="navbar-text my-2 ml-2">{{page_title}}</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
{% extends "statistiques/base.html" %}
|
||||
|
||||
{% block title %}{{block.super}} Typologie{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}{{block.super}}<li>Typologie</li>{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{{ block.super }}
|
||||
{% include "statistiques/filter_form.html" %}
|
||||
<p class="text-muted px-3">Échantillon : {{ queryset.count }} sujets</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
<script type="text/javascript">
|
||||
function hideAll() {
|
||||
{% for _, graph in graphs %}{% with graph.get_html_id as id %}
|
||||
$("#tab-{{id}}").attr("class", "");
|
||||
$("#wrapper-{{id}}").hide();
|
||||
{% endwith %}{% endfor %}
|
||||
}
|
||||
|
||||
function showGraph(id) {
|
||||
hideAll();
|
||||
$("#tab-" + id).attr("class", "active");
|
||||
$("#wrapper-" + id).show();
|
||||
}
|
||||
</script>
|
||||
<ul class="nav nav-tabs">
|
||||
{% for title, graph in graphs %}
|
||||
<li class="nav-item" id="tab-{{graph.get_html_id}}">
|
||||
<a class="nav-link" href="#" onclick="showGraph('{{graph.get_html_id}}');">{{ title }}</a>
|
||||
</li>{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% for title, graph in graphs %}
|
||||
{{ graph.as_html }}
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,14 +1,15 @@
|
||||
from django import template
|
||||
from itertools import zip_longest
|
||||
from itertools import zip_longest, islice
|
||||
|
||||
register = template.Library()
|
||||
|
||||
def get_columns(iterable, cols):
|
||||
cols_len = len(iterable) // cols
|
||||
if len(iterable) % cols != 0:
|
||||
cols_len += 1
|
||||
for i in range(cols):
|
||||
yield iterable[i*cols_len:(i+1)*cols_len]
|
||||
def get_rows(iterable, cols):
|
||||
""" Returns a tuple of rows """
|
||||
i = iter(iterable)
|
||||
row = tuple(islice(i, cols))
|
||||
while row:
|
||||
yield row
|
||||
row = tuple(islice(i, cols))
|
||||
|
||||
@register.inclusion_tag("tables/table.html")
|
||||
def table(object_list, cols=2, cell_template="tables/table_cell_default.html", header=None):
|
||||
@@ -17,8 +18,6 @@ def table(object_list, cols=2, cell_template="tables/table_cell_default.html", h
|
||||
'cell_template': cell_template,
|
||||
'cols_number': cols,
|
||||
'header': header,
|
||||
'rows': tuple(zip_longest( *get_columns(object_list, cols),
|
||||
fillvalue=None
|
||||
))
|
||||
'rows': tuple(get_rows(object_list, cols)),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user