changes order in tables, fixes statistiques views navbar titles
This commit is contained in:
@@ -2,7 +2,13 @@
|
|||||||
{% load bootstrap4 notes %}
|
{% load bootstrap4 notes %}
|
||||||
|
|
||||||
{% block page_content %}
|
{% 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">
|
<div class="col-lg-7 col-md-12">
|
||||||
|
{% block pagination %}{% endblock %}
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
{% for note in notes %}
|
{% for note in notes %}
|
||||||
{% if maraude %}
|
{% if maraude %}
|
||||||
@@ -12,7 +18,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% block pagination %}{% endblock %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-5 col-md-12">
|
<div class="col-lg-5 col-md-12">
|
||||||
|
|||||||
@@ -29,13 +29,12 @@
|
|||||||
</nav>
|
</nav>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block right_column %}
|
{% block top_block %}
|
||||||
<div class="card ml-auto position-fixed">
|
<div class="card card-body p-1 mb-2 text-center">
|
||||||
<h6 class="card-header">Informations</h6>
|
<p class="card-text">
|
||||||
<div class="card-body">
|
<strong>avec {{ maraude.binome }} & {{ maraude.referent }}</strong>
|
||||||
<p><strong>Maraudeurs :</strong> {{ maraude.binome }} & {{ maraude.referent }}</p>
|
<span class="badge badge-primary ml-2">{{ maraude.rencontres.count }} rencontres</span>
|
||||||
<p><strong>Nombre de rencontres</strong> {{ maraude.rencontres.count }}</p>
|
<span class="badge badge-primary ml-2">{{ maraude.observations_count }} personnes rencontrées</span>
|
||||||
<p><strong>Nombre de personnes rencontrées</strong> {{ maraude.observations_count }}</p>
|
</p>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -9,6 +9,12 @@
|
|||||||
<h6 class="navbar-text text-white my-2">{{ sujet }}</h6>
|
<h6 class="navbar-text text-white my-2">{{ sujet }}</h6>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block top_block %}
|
||||||
|
<div class="card card-body p-1 mb-2">
|
||||||
|
{% include "notes/details_sujet_inner.html" %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block pagination %}
|
{% block pagination %}
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center">
|
||||||
{% if notes.has_other_pages %}<ul class="pagination">
|
{% if notes.has_other_pages %}<ul class="pagination">
|
||||||
@@ -20,11 +26,6 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block right_column %}
|
{% block right_column %}
|
||||||
<div class="card">
|
|
||||||
<h6 class="card-header">Informations</h6>
|
|
||||||
{% include "notes/details_sujet_inner.html" %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card mt-2">
|
<div class="card mt-2">
|
||||||
<h6 class="card-header">Statistiques</h6>
|
<h6 class="card-header">Statistiques</h6>
|
||||||
<div id="stats-content">
|
<div id="stats-content">
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
{% block title %}Statistiques >{% endblock %}
|
{% block title %}Statistiques >{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
<li><a href="{% url "statistiques:index" %}">Statistiques</a></li>
|
<h6 class="navbar-text text-white my-2">Statistiques</h6>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% 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 title %}{{ block.super }} Maraudes{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
{% include "statistiques/filter_form.html" %}
|
{% include "statistiques/filter_form.html" %}
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
<li>Données générales</li>
|
<p class="navbar-text my-2 ml-2">Données générales</p>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
{% block breadcrumbs %}
|
{% block breadcrumbs %}
|
||||||
{{block.super}}
|
{{block.super}}
|
||||||
<li>{{page_title}}</li>
|
<p class="navbar-text my-2 ml-2">{{page_title}}</p>
|
||||||
{% if active %}<li>{{active}}</li>{% endif %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% 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 django import template
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest, islice
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
def get_columns(iterable, cols):
|
def get_rows(iterable, cols):
|
||||||
cols_len = len(iterable) // cols
|
""" Returns a tuple of rows """
|
||||||
if len(iterable) % cols != 0:
|
i = iter(iterable)
|
||||||
cols_len += 1
|
row = tuple(islice(i, cols))
|
||||||
for i in range(cols):
|
while row:
|
||||||
yield iterable[i*cols_len:(i+1)*cols_len]
|
yield row
|
||||||
|
row = tuple(islice(i, cols))
|
||||||
|
|
||||||
@register.inclusion_tag("tables/table.html")
|
@register.inclusion_tag("tables/table.html")
|
||||||
def table(object_list, cols=2, cell_template="tables/table_cell_default.html", header=None):
|
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,
|
'cell_template': cell_template,
|
||||||
'cols_number': cols,
|
'cols_number': cols,
|
||||||
'header': header,
|
'header': header,
|
||||||
'rows': tuple(zip_longest( *get_columns(object_list, cols),
|
'rows': tuple(get_rows(object_list, cols)),
|
||||||
fillvalue=None
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user