lots of fixes

This commit is contained in:
artus
2018-10-14 21:49:38 +02:00
parent 65a31c0a1b
commit 456cdf3704
11 changed files with 42 additions and 80 deletions

View File

@@ -3,16 +3,7 @@
{% block page_content %} {% block page_content %}
<div class="col-lg-7 col-md-12"> <div class="col-lg-7 col-md-12">
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <table class="table table-bordered">
<div class="panel panel-primary">
<div class="panel-heading" role="tab" id="notesHeading">
<h3 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseNotes" aria-expanded="true" aria-controls="collapseOne">
Notes</a>
</h3>
</div>
{% block pre_content %}{% endblock %}
<table class="table table-striped table-bordered">
{% for note in notes %} {% for note in notes %}
{% if maraude %} {% if maraude %}
{% inline_table note header="sujet" %} {% inline_table note header="sujet" %}
@@ -21,9 +12,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</table> </table>
{% block post_content %}{% endblock %} {% block pagination %}{% endblock %}
</div>
</div>
</div> </div>
<div class="col-lg-5 col-md-12"> <div class="col-lg-5 col-md-12">

View File

@@ -30,7 +30,7 @@
{% endblock %} {% endblock %}
{% block right_column %} {% block right_column %}
<div class="card position-fixed"> <div class="card ml-auto position-fixed">
<h6 class="card-header">Informations</h6> <h6 class="card-header">Informations</h6>
<div class="card-body"> <div class="card-body">
<p><strong>Maraudeurs :</strong>&nbsp; {{ maraude.binome }} & {{ maraude.referent }}</p> <p><strong>Maraudeurs :</strong>&nbsp; {{ maraude.binome }} & {{ maraude.referent }}</p>

View File

@@ -6,55 +6,27 @@
{% endblock %} {% endblock %}
{% block breadcrumbs %} {% block breadcrumbs %}
{{ block.super }} <h6 class="navbar-text text-white my-2">{{ sujet }}</h6>
<li><a href="{% url "notes:liste-sujet" %}">Sujets</a></li>
<li>{{ sujet }}</li>
{% endblock %} {% endblock %}
{% block pre_content %} {% block pagination %}
<div id="collapseNotes" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="notesHeading"> <div class="d-flex justify-content-center">
{% endblock %} {% if notes.has_other_pages %}<ul class="pagination">
{% block post_content %}
{% if notes.has_other_pages %}<div class="panel-footer text-center">
<ul class="pagination">
{% for num in notes.paginator.page_range %} {% for num in notes.paginator.page_range %}
<li {% if notes.number == num %} class="active" {%endif%}><a href="?page={{num}}">{{num}}</a></li> <li class="page-item {% if notes.number == num %}active{%endif%}"><a class="page-link" href="?page={{num}}">{{num}}</a></li>
{%endfor%} {%endfor%}
</ul> </ul>{% endif %}
</div>{% endif %}
</div>
</div> </div>
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="notesAjoutHeading">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseNotesAjout" aria-expanded="false" aria-controls="collapseTwo">
Ajouter une note
</a>
</h4>
</div>
<div id="collapseNotesAjout" class="panel-collapse collapse" role="tabpanel" aria-labelledby="notesAjoutHeading">
<div class="panel-body">
<form method="POST" action="">{% csrf_token %}
{% bootstrap_form note_form show_label=False %}
</div>
<div class="panel-footer text-right">
{% bootstrap_button "Enregistrer" button_type="submit" %}
</form>
</div>
</div>
{% endblock %} {% endblock %}
{% block right_column %} {% block right_column %}
<div class="panel panel-default"> <div class="card">
<div class="panel-heading"> <h6 class="card-header">Informations</h6>
<h4 class="panel-title">Informations</h4>
</div>
{% include "notes/details_sujet_inner.html" %} {% include "notes/details_sujet_inner.html" %}
</div> </div>
<div class="panel panel-default"> <div class="card mt-2">
<div class="panel-heading"><h4 class="panel-title">Statistiques</h4></div> <h6 class="card-header">Statistiques</h6>
<div id="stats-content"> <div id="stats-content">
{% include "statistiques/fiche_stats_details.html" with object=sujet.statistiques %} {% include "statistiques/fiche_stats_details.html" with object=sujet.statistiques %}
</div> </div>
@@ -89,6 +61,7 @@
{% block sidebar %} {% block sidebar %}
{{ block.super }} {{ block.super }}
<h6 class="sidebar-heading mt-4 px-3 text-danger">TODO: Ajouter une note</h6>
{% if user.is_superuser %} {% if user.is_superuser %}
<h6 class="sidebar-heading mt-4 px-3">Administration</h6> <h6 class="sidebar-heading mt-4 px-3">Administration</h6>
<div class="px-3 btn-group-vertical d-flex justify-content-center" role="group" aria-label="..."> <div class="px-3 btn-group-vertical d-flex justify-content-center" role="group" aria-label="...">

View File

@@ -1,5 +1,5 @@
<div id="sujet-content"> <div id="sujet-content">
<table class="table table-striped"> <table class="table table-sm table-striped">
{% with "-" as none %} {% with "-" as none %}
<tr><th>Nom</th><th>Surnom</th><th>Prénom</th></tr> <tr><th>Nom</th><th>Surnom</th><th>Prénom</th></tr>
<tr><td>{{ sujet.nom|default:none }}</td><td>{{ sujet.surnom|default:none}}</td><td>{{ sujet.prenom|default:none}}</td></tr> <tr><td>{{ sujet.nom|default:none }}</td><td>{{ sujet.surnom|default:none}}</td><td>{{ sujet.prenom|default:none}}</td></tr>
@@ -7,9 +7,7 @@
<tr><td>{{ sujet.age|default_if_none:none }}</td><td colspan="2">{{ sujet.premiere_rencontre|default_if_none:none }}</td></tr> <tr><td>{{ sujet.age|default_if_none:none }}</td><td colspan="2">{{ sujet.premiere_rencontre|default_if_none:none }}</td></tr>
{% endwith %} {% endwith %}
</table> </table>
<div class="panel-footer text-right" id="sujet-buttons"> <button class="btn btn-primary btn-sm btn-block" id="update-sujet">Mettre à jour</a></span>
<span class="text-right"><span class="btn btn-primary btn-sm" id="update-sujet">Mettre à jour</a></span>
</div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">

View File

@@ -1,16 +1,16 @@
{% load bootstrap3 %} {% load bootstrap4 %}
<form action="{% url "notes:update-sujet" form.instance.pk %}" method="post">{% csrf_token %} <form action="{% url "notes:update-sujet" form.instance.pk %}" method="post">{% csrf_token %}
<table class="table table-striped"> <table class="table table-sm table-striped">
{% with "-" as none %} {% with none="-" sz="small" %}
<tr><th>Nom</th><th>Surnom</th><th>Prénom</th></tr> <tr><th>Nom</th><th>Surnom</th><th>Prénom</th></tr>
<tr><td>{% bootstrap_field form.nom show_label=False %}</td><td>{% bootstrap_field form.surnom show_label=False %}</td><td>{% bootstrap_field form.prenom show_label=False %}</td></tr> <tr><td>{% bootstrap_field form.nom size=sz show_label=False %}</td><td>{% bootstrap_field form.surnom size=sz show_label=False %}</td><td>{% bootstrap_field form.prenom size=sz show_label=False %}</td></tr>
<tr><th>Âge</th><th>Genre</th><th>Première rencontre</th></tr> <tr><th>Âge</th><th>Genre</th><th>Première rencontre</th></tr>
<tr><td>{% bootstrap_field form.age show_label=False %}</td><td>{% bootstrap_field form.genre show_label=False %}</td><td>{% bootstrap_field form.premiere_rencontre show_label=False %}</td></tr> <tr><td>{% bootstrap_field form.age size=sz show_label=False %}</td><td>{% bootstrap_field form.genre size=sz show_label=False %}</td><td>{% bootstrap_field form.premiere_rencontre size=sz show_label=False %}</td></tr>
{% endwith %} {% endwith %}
</table> </table>
<div class="panel-footer text-right"> <div class="btn-group d-flex flex-fill">
<span class="text-right">{% bootstrap_button "Enregistrer" button_type="submit" %} {% bootstrap_button "Enregistrer" button_type="submit" button_class="btn btn-success btn-sm" %}
<span class="btn btn-primary btn-sm" id="cancel">Annuler</span></span> <button class="btn btn-primary btn-sm" id="cancel">Annuler</button>
</div> </div>
</form> </form>

View File

@@ -1,4 +1,4 @@
<tr > <tr class="d-table-row shadow">
<th class="border-{{bg_color}}" width="20%"> <th class="border-{{bg_color}}" width="20%">
{% if link %} {% if link %}
<a href="{{link}}"><strong>{{header}}</strong></a> <a href="{{link}}"><strong>{{header}}</strong></a>
@@ -6,7 +6,7 @@
<strong>{{header}}</strong> <strong>{{header}}</strong>
{% endif %} <small>{{small}}</small> {% endif %} <small>{{small}}</small>
<br /> <br />
<div style="margin:5px 0px;"> <div style="mt-2">
{% for label in labels %} {% for label in labels %}
<span class="badge badge-{{bg_label_color}}" style="padding:2px 5px;">{{label}}</span> <span class="badge badge-{{bg_label_color}}" style="padding:2px 5px;">{{label}}</span>
{% endfor %} {% endfor %}

View File

@@ -88,7 +88,8 @@ class MaraudeListView(ListView):
queryset = Maraude.objects.get_past().order_by("-date") queryset = Maraude.objects.get_past().order_by("-date")
filters = [ filters = [
("Ce mois-ci", lambda qs: qs.filter(date__month=timezone.now().date().month)), ("Ce mois-ci", lambda qs: qs.filter(date__month=timezone.now().date().month,
date__year=timezone.now().date().year)),
] ]

View File

@@ -1,7 +1,8 @@
{% load boolean_icons bootstrap4 %} {% load boolean_icons bootstrap4 %}
<table class="table"> {% with th_css="bg-dark text-white" %}
<table class="table table-sm">
<tr> <tr>
<th colspan="4" class="active">Problématiques</th> <th colspan="4" class="{{th_css}}">Problématiques</th>
</tr> </tr>
<tr> <tr>
<th>Psychiatrique</th> <th>Psychiatrique</th>
@@ -16,7 +17,7 @@
<td>{{ object.prob_somatique|as_icon }}</td> <td>{{ object.prob_somatique|as_icon }}</td>
</tr> </tr>
<tr> <tr>
<th colspan="4" class="active">Habitation</th> <th colspan="4" class="{{th_css}}">Habitation</th>
</tr> </tr>
<tr> <tr>
<th>Type</th> <th>Type</th>
@@ -25,13 +26,13 @@
<td>{{ object.connu_siao|as_icon }}</td> <td>{{ object.connu_siao|as_icon }}</td>
</tr> </tr>
<tr> <tr>
<th colspan="4" class="active">Ressources</th> <th colspan="4" class="{{th_css}}">Ressources</th>
</tr> </tr>
<tr> <tr>
<td colspan="4">{{ object.ressources }}</td> <td colspan="4">{{ object.ressources }}</td>
</tr> </tr>
<tr> <tr>
<th colspan="4" class="active">Parcours de vie</th> <th colspan="4" class="{{th_css}}">Parcours de vie</th>
</tr> </tr>
<tr> <tr>
<td colspan="2">{{ object.parcours_de_vie }}</td> <td colspan="2">{{ object.parcours_de_vie }}</td>
@@ -39,4 +40,4 @@
<td>{{ object.lien_familial|as_icon }}</td> <td>{{ object.lien_familial|as_icon }}</td>
</tr> </tr>
</table> </table>
{% endwith %}

View File

@@ -1,8 +1,8 @@
{% load bootstrap3 %} {% load bootstrap4 %}
<form action="{% url "statistiques:update" form.instance.pk %}" method="post" id="update-stats-form">{% csrf_token%} <form action="{% url "statistiques:update" form.instance.pk %}" method="post" id="update-stats-form">{% csrf_token%}
<table class="table"> <table class="table">
<tr> <tr>
<th colspan="4" class="active">Problématiques</th> <th colspan="4" class="bg-dark text-white">Problématiques</th>
</tr> </tr>
<tr> <tr>
<th>Psychiatrique</th> <th>Psychiatrique</th>

View File

@@ -1,4 +1,4 @@
<table class="table table-striped table-borderless shadow"> <table class="table table-borderless shadow">
{% if header %}<tr> {% if header %}<tr>
<th colspan="{{ cols_number }}" class="thead-dark text-center">{{ header }}</th> <th colspan="{{ cols_number }}" class="thead-dark text-center">{{ header }}</th>
</tr>{% endif %} </tr>{% endif %}

View File

@@ -4,11 +4,11 @@ register = template.Library()
@register.filter @register.filter
def as_icon(value): def as_icon(value):
icons = {True: "ok", icons = {True: "circle-check",
False: "remove", False: "circle-x",
None: "asterisk" None: "question-mark"
} }
if not value in icons: if not value in icons:
raise ValueError(value, 'is not a boolean or empty value !') raise ValueError(value, 'is not a boolean or empty value !')
else: else:
return format_html('<span class="glyphicon glyphicon-{}"></span>', icons[value]) return format_html('<span class="oi oi-{}" aria-hidden="true"></span>', icons[value])