Commit 872e73a9 authored by hypsug0's avatar hypsug0
Browse files

refactor: Move respective templates to modules

parent 1c113da9
......@@ -91,6 +91,7 @@ PROJECT_APPS = [
"sights",
"blog",
"api",
"synthesis",
]
# INSTALLED_APPS = PREREQ_APPS + PROJECT_APPS
......
......@@ -79,7 +79,7 @@ class MetaPlaceList(LoginRequiredMixin, FilterView, ExportMixin, SingleTableView
table_class = MetaPlaceTable
# form_class = MetaPlaceSearchFilterForm
model = MetaPlace
template_name = "sights/metaplace_search.html"
template_name = "metaplace_search.html"
table_pagination = {"per_page": 15}
filterset_class = MetaPlaceFilter
......@@ -98,7 +98,7 @@ class MetaPlaceList(LoginRequiredMixin, FilterView, ExportMixin, SingleTableView
class MetaPlaceDetail(LoginRequiredMixin, DetailView):
model = MetaPlace
template_name = "sights/metaplace_detail.html"
template_name = "metaplace_detail.html"
def get_context_data(self, **kwargs):
context = super(MetaPlaceDetail, self).get_context_data(**kwargs)
......
......@@ -156,7 +156,7 @@ class SightingDelete(SightingEditAuthMixin, DeleteView):
class SightingDetail(SightingViewAuthMixin, DetailView):
model = Sighting
template_name = "sights/sighting_detail.html"
template_name = "sighting_detail.html"
def get_context_data(self, **kwargs):
context = super(SightingDetail, self).get_context_data(**kwargs)
......@@ -315,7 +315,7 @@ class SightingUserList(AdvancedUserViewMixin, ExportMixin, SingleTableView):
class SightingSearch(LoginRequiredMixin, TemplateView):
template_name = "sights/sighting_search.html"
template_name = "sighting_search.html"
def get_context_data(self, **kwargs):
context = super(SightingSearch, self).get_context_data(**kwargs)
......@@ -333,7 +333,7 @@ class SightingSearch(LoginRequiredMixin, TemplateView):
class SightingEditForm(SessionEditAuthMixin, DetailView):
model = Session
template_name = "sights/sighting_form.html"
template_name = "sighting_form.html"
def get_context_data(self, **kwargs):
context = super(SightingEditForm, self).get_context_data(**kwargs)
......
......@@ -141,7 +141,7 @@ class PlaceCreate(LoginRequiredMixin, CreateView):
class PlaceDetail(PlaceViewAuthMixin, DetailView):
model = Place
template_name = "sights/place_detail.html"
template_name = "place_detail.html"
def get_context_data(self, **kwargs):
context = super(PlaceDetail, self).get_context_data(**kwargs)
......@@ -298,7 +298,7 @@ class PlaceDelete(PlaceEditAuthMixin, DeleteView):
class PlaceList(LoginRequiredMixin, TemplateView):
template_name = "sights/place_search.html"
template_name = "place_search.html"
def get_context_data(self, **kwargs):
context = super(PlaceList, self).get_context_data(**kwargs)
......@@ -317,7 +317,7 @@ class PlaceList(LoginRequiredMixin, TemplateView):
class PlaceMyList(LoginRequiredMixin, TemplateView):
template_name = "sights/place_search.html"
template_name = "place_search.html"
def get_context_data(self, **kwargs):
logged_user = self.request.user
......@@ -540,7 +540,7 @@ class TreeDelete(PlaceDetailEditAuthMixin, DeleteView):
class TreeDetail(PlaceDetailViewAuthMixin, DetailView):
model = Tree
template_name = "sights/tree_detail.html"
template_name = "tree_detail.html"
def get_context_data(self, **kwargs):
context = super(TreeDetail, self).get_context_data(**kwargs)
......
......@@ -143,7 +143,7 @@ class SessionDelete(SessionEditAuthMixin, DeleteView):
class SessionDetail(SessionViewAuthMixin, DetailView):
model = Session
template_name = "sights/session_detail.html"
template_name = "session_detail.html"
def get_context_data(self, **kwargs):
context = super(SessionDetail, self).get_context_data(**kwargs)
......
{% extends 'base_fullwidth_leaflet.html' %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% block title %}{{title}} | {{object.session.date_start}} - {{object.session.contact.descr}} |
{{object.session.place.name}}{% endblock %}
{% block content %}
<h1><i class="{{ icon | safe }}"></i> {{ title | safe }}</h1>
<p>
<small>Observation créée par <b>{{ object.created_by }}</b> le <b>{{ object.timestamp_create }}</b>
{% if object.updated_by %}et
mise à jour le <b>{{ object.timestamp_update }}</b> par <b>{{ object.updated_by }}</b>
</small>{% endif %}
| session du <a href="{% url 'sights:session_detail' pk=object.session.pk %}">{{object.session.date_start}}
({{object.session.contact.descr}})</a> | localité <a
href="{% url 'sights:place_detail' pk=object.session.place.pk %}">{{object.session.place.name}}</a>
</p>
<div class="row">
<div class="col-md-12 col-lg-5">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="pull-right btn-group">
<a href="{% url 'sights:sighting_edit_form' pk=object.session.pk %}" class="btn btn-default btn-xs"><i
class="fa fa-edit fa-fw"></i><span class="hidden-xs"> Modifier</span></a>
<a href="{% url 'sights:sighting_delete' pk=object.pk %}" class="btn btn-danger btn-xs"><i
class="fa fa-trash fa-fw"></i><span class="hidden-xs"> Supprimer</span></a>
<a href="{% url 'sights:session_detail' pk=object.session.pk %}" class="btn btn-info btn-xs"><i
class="fa fa-chevron-left fa-fw"></i><span class="hidden-xs"> Session</span></a>
</div>
<h4 class="panel-title"><i class="fa fa-info-circle fa-fw"></i> Informations sur l'observation</h4>
</div>
<div role="tabpanel">
<ul id="myTab" class="nav nav-tabs">
<li role="navigation" class="active"><a class="tab" href="#mainInfo" aria-controls="maininfo" role="tab"
data-toggle="tab">Informations
principales</a>
</li>
<li role="navigation"><a href="#otherInfo" aria-controls="otherinfo" role="tab" data-toggle="tab">Autres
infos</a>
</li>
</ul>
<div class="tab-content">
{# <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"#}
{# aria-labelledby="headingOne">#}
<div role="tabpanel" class="tab-pane active" id="mainInfo">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<fieldset>
<legend>Données principales</legend>
<div class="row">
<div class="col-lg-12">
<label>Espèce</label>
<div class="well well-sm">
{% trans "Nom commun" %} :
<strong>{{ object.codesp.common_name_fr }}</strong>
{% if object.codesp.sp_true %}
<span class="label label-success">{% trans "Espèce vraie" %}</span>
{%endif%}<br />
{% trans "Nom scientifique" %} :
<i>{{ object.codesp.sci_name }}</i><br />
{% if object.codesp.full_name %}
{{ object.codesp.full_name }}
{%endif%}
</div>
</div>
<div class="col-xs-12 col-sm-6">
<label>Nombre</label>
<div class="well well-sm">
<strong>{{ object.total_count }}</strong>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<label>Donnée douteuse</label>
<div class="well well-sm">
{% if object.is_doubtful %}
<span class="label label-warning"><i class="fa fa-exclamation-triangle fa-fw"></i></span>
<b>Oui</b>
{% else %}
<span class="label label-success"><i class="fa fa-check fa-fw"></i></span>
<b>Non</b>
{% endif %}
</div>
</div>
<div class="col-xs-12 col-sm-6">
<label>Colonie de reproduction</label>
<div class="well well-sm">
{% if object.breed_colo %}
<b><span class="label label-success"><i class="fa fa-check fa-fw"></i></span>
</b>{% endif %}{{object.breed_colo|yesno:"Oui,Non,Inconnu"}}
</div>
</div>
<div class="col-xs-12 col-sm-6">
<label>Période</label>
<div class="well well-sm">
{{ object.period }}
</div>
</div>
{% if object.session.is_confidential %}
<div class="col-lg-12">
<div class="alert alert-danger" role="alert">
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
{% trans "Cette donnée est confidentielle" %}
</div>
</div>
{% endif %}
</div>
</fieldset>
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="otherInfo">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
{% if object.data_file or object.bdsource or object.comment %}
{% if object.data_file %}
<fieldset>
<legend>Fichiers</legend>
<div class="row">
<div class="col-lg-12">
<label>Fichiers relatifs à la session</label>
<div class="well well-sm">{{ object.data_file }}</div>
</div>
</div>
</fieldset>
{% endif %}
{% if object.bdsource %}
<fieldset>
<legend>BD Source</legend>
<div class="row">
<div class="col-md-6 col-xs-12">
<label>Source de la localité</label>
<div class="well well-sm">{{ object.bdsource }}</div>
</div>
<div class="col-md-6 col-xs-12">
<label>Identifiant de la localité dans la base de donnée
source</label>
<div class="well well-sm">{{ object.id_bdsource }}</div>
</div>
</div>
</fieldset>
{% endif %}
{% if object.comment %}
</fieldset>
<legend>Commentaire</legend>
<div class="row">
<div class="col-lg-12">
<div class="well well-sm">{{ object.comment|safe }}</div>
</div>
</div>
<fieldset>
{% endif %}
{% else %}
{% trans "Aucune" %}
{% endif %}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% comment %}
DONNEES ATTRIBUEES A LA SESSION
{% endcomment %}
<div class="col-md-12 col-lg-7">
{% comment %}
BLOC1: Espèces observées
{% endcomment %}
<div id="accordion" class="panel-group">
{% comment %}
BLOC1: Sessions d'inventaires
{% endcomment %}
<div class="panel panel-default panel-info panel-table">
<!-- Default panel contents -->
<div class="panel-heading">
<div class="pull-right btn-group btn-group-xs">
{% if countdetailcount > 0 %}
<a class="btn btn-default" data-toggle="collapse" data-parent="#accordion" href="#collapseCountdetail"
title="voir/cacher la liste"><span class="caret"></span></a>
{% endif %}
<button data-toggle="modal" data-target="#FsCountDetail" class="btn btn-default btn-xs"><i
class="fa fa-arrows-alt fa-fw"></i><span class="hidden-xs"> Plein écran</span>
</button>
<a href="{% url 'sights:countdetail_create' pk=object.pk %}" class="btn btn-primary btn-xs"><i
class="fi-plus"></i><span class="hidden-xs"> Ajouter</span></a>
</div>
<h4><i class="{{ countdetailicon | safe }}"></i> {{ countdetailtitle | safe }}</a>
{% if sightingcount > 0 %}
<a data-toggle="collapse" data-parent="#accordion" href="#collapseCountdetail"
title="voir/cacher la liste"><span class="badge">{{ countdetailcount }}</span></a>
{% else %}
<span class="badge">{{ countdetailcount }}</span>
{% endif %}
</h4>
</div>
<!-- Table -->
{% if countdetailcount > 0 %}
<div id="collapseCountdetail" class="panel-body">
{% render_table countdetailtable %}
</div>
<!-- Data FullScreen Modal -->
<div class="modal fullscreen-modal fade" id="FsCountDetail" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
{% render_table countdetailtable %}
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}
{% extends "base.html" %}
{% block title %}En synthèse{% endblock %}
{% block content %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
{% comment %} <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script> {% endcomment %}
<h1><i class="{{ icon|safe }}"></i> {{ title }}</h1>
<div class="row" style="text-align: center; font-size: 2rem">
......@@ -81,6 +81,8 @@
</div>
</div>
<script>
$(document).ready(() => {
const dynamicColors = () => {
const r = Math.floor(Math.random() * 255);
const g = Math.floor(Math.random() * 255);
......@@ -146,6 +148,7 @@
data: {
labels: {{ list_contact|safe }},
datasets: [{
label:'Contacts',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgb(255, 99, 132)',
data: {{ contact_contrib }},
......@@ -169,6 +172,7 @@
data: {
labels: {{ list_territory|safe }},
datasets: [{
label:'Territoires',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgb(255, 99, 132)',
data: {{ territory_contrib }},
......@@ -181,5 +185,6 @@
}],
}
});
})
</script>
{% endblock %}
......@@ -10,7 +10,7 @@ from sights.models import Place, Session, Sighting
class GlobalContribView(TemplateView):
template_name = "synthesis/contrib.html"
template_name = "contrib.html"
def get_context_data(self, **kwargs):
context = super(GlobalContribView, self).get_context_data(**kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment