cleaning up, improved scripts and menus
This commit is contained in:
@@ -15,6 +15,7 @@ admin.site.register(Lieu)
|
||||
# Inlines
|
||||
class ObservationInline(admin.StackedInline):
|
||||
model = Observation
|
||||
extra = 0
|
||||
|
||||
|
||||
@admin.register(Rencontre)
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
{% load bootstrap3 %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% load bootstrap3 %}{% load staticfiles %}
|
||||
{{ form.media.js }}{{ form.media.css }}
|
||||
<script type="text/javascript" src="{% static "jquery.formset.js" %}"></script>
|
||||
<script type="text/javascript">
|
||||
/* Dynamic Formsets */
|
||||
$(function() {
|
||||
$.fn.onAddForm = function(row) {
|
||||
/*
|
||||
* Custom code to integrate with django-select2 and bootstrap3
|
||||
*/
|
||||
// Load django_select2 fields
|
||||
row.find('.django-select2').djangoSelect2();
|
||||
var button = row.find('a.btn-delete')
|
||||
@@ -22,8 +18,6 @@
|
||||
*/
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
$(function() {
|
||||
$('.dynamic-formset').formset({
|
||||
prefix: '{{ inline_formset.prefix }}',
|
||||
@@ -40,67 +34,8 @@
|
||||
text = $('a.btn-delete:first').text()
|
||||
$('a.btn-delete').html('<span class="glyphicon glyphicon-minus"></span> ' + text);
|
||||
});
|
||||
|
||||
|
||||
/* Lier les boutons de création
|
||||
* Thanks to Derek Morgan, https://dmorgan.info/posts/django-views-bootstrap-modals/
|
||||
*/
|
||||
$(function() {
|
||||
|
||||
var formAjaxSubmit = function(form, modal) {
|
||||
$(form).submit(function (e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: $(this).attr('method'),
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
success: function (xhr, ajaxOptions, thrownError) {
|
||||
if ( $(xhr).find('.has-error').length > 0 ) {
|
||||
$(modal).find('.modal-body').html(xhr);
|
||||
formAjaxSubmit(form, modal);
|
||||
} else {
|
||||
$(modal).modal('toggle');
|
||||
// Reload page ?
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
// handle response errors here
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/* TODO: Use formAjaxSubmit above, but reload page on form success */
|
||||
$('#new-sujet').click(function() {
|
||||
$('#form-modal-body').load('{% url "sujets:create" %}?next={% url "maraudes:create" pk=maraude.id %}', function () {
|
||||
$('.modal-title').text("Nouveau sujet");
|
||||
$('#form-modal').modal('toggle');
|
||||
});
|
||||
});
|
||||
$('#new-lieu').click(function() {
|
||||
$('#form-modal-body').load('{% url "maraudes:lieu-create" %}?next={% url "maraudes:create" pk=maraude.id %}', function () {
|
||||
$('.modal-title').text("Nouveau lieu");
|
||||
$('#form-modal').modal('toggle');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="form-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Modal title</h4>
|
||||
</div>
|
||||
<div id="form-modal-body" class="modal-body">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sd-12">
|
||||
<form method="post" action="{% url 'maraudes:create' maraude.pk %}?finalize=False">
|
||||
@@ -114,18 +49,9 @@
|
||||
<div class="panel-body">
|
||||
{% include "compte_rendu/compterendu_form.html" %}
|
||||
</div>
|
||||
<div class="panel-footer text-right">
|
||||
<div class="btn-group">
|
||||
<a class= "btn btn-primary" id="new-sujet">
|
||||
{% bootstrap_icon "user" %} Nouveau sujet</a>
|
||||
<a class="btn btn-primary" id="new-lieu">
|
||||
{% bootstrap_icon "globe" %} Nouveau lieu</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 col-sd-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><h4>Enregistrées
|
||||
@@ -142,3 +68,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="form-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Modal title</h4>
|
||||
</div>
|
||||
<div id="form-modal-body" class="modal-body">
|
||||
<div class="alert alert-warning">Content should be there...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{% load bootstrap3 %}
|
||||
{% load bootstrap3 %}{% load staticfiles %}
|
||||
<div class="form-inline well well-sm text-center">
|
||||
{% if form.id %}{% bootstrap_field form.id %}{% endif %}
|
||||
{% bootstrap_field form.lieu layout="inline" size="small" %}
|
||||
@@ -27,36 +27,4 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
|
||||
var input = $('#id_heure_debut')
|
||||
var min_value = input.attr('value').split(":")
|
||||
|
||||
$.fn.editHeureValue = function(mod) {
|
||||
var input = $('#id_heure_debut');
|
||||
var value = input.attr('value').split(":");
|
||||
value[1] = parseInt(value[1]) + mod;
|
||||
|
||||
do_change = true
|
||||
for (i=0; i < 3; i++){
|
||||
if (value[i] < min_value[i]){
|
||||
do_change = false
|
||||
};
|
||||
};
|
||||
new_value = value.join(":");
|
||||
if (do_change){
|
||||
input.attr('value', new_value);
|
||||
};
|
||||
};
|
||||
|
||||
$('#minus-5').click(function() {
|
||||
$.fn.editHeureValue(-5)
|
||||
console.log('minus 5')
|
||||
});
|
||||
$('#plus-5').click(function() {
|
||||
$.fn.editHeureValue(5)
|
||||
console.log('plus 5')
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="{% static "scripts/update_time.js" %}"></script>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
{% if user.is_superuser %}{% load bootstrap3 %}
|
||||
<li class="dropdown app-menu"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Création<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" id="new-sujet">{% bootstrap_icon "user" %} Nouveau sujet</a></li>
|
||||
<li><a href="#" id="new-lieu">{% bootstrap_icon "globe" %} Nouveau lieu</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<script type="text/javascript">
|
||||
/* Lier les boutons de création
|
||||
* Thanks to Derek Morgan, https://dmorgan.info/posts/django-views-bootstrap-modals/
|
||||
*/
|
||||
$(function() {
|
||||
|
||||
var formAjaxSubmit = function(form, modal) {
|
||||
$(form).submit(function (e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: $(this).attr('method'),
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
success: function (xhr, ajaxOptions, thrownError) {
|
||||
if ( $(xhr).find('.has-error').length > 0 || $(xhr).find('.alert-danger').length > 0) {
|
||||
$(modal).find('.modal-body').html(xhr);
|
||||
formAjaxSubmit(form, modal);
|
||||
} else {
|
||||
$(modal).modal('toggle');
|
||||
// Reload page ?
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
// handle response errors here
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/* TODO: Use formAjaxSubmit above, but reload page on form success */
|
||||
$('#new-sujet').click(function() {
|
||||
$('#form-modal-body').load('{% url "sujets:create" %}?next={% url "maraudes:create" pk=maraude.id %}', function () {
|
||||
$('.modal-title').text("Nouveau sujet");
|
||||
$('#form-modal').modal('toggle');
|
||||
formAjaxSubmit("#form-modal-body form", "#form-modal");
|
||||
});
|
||||
});
|
||||
$('#new-lieu').click(function() {
|
||||
|
||||
$('#form-modal-body').load('{% url "maraudes:lieu-create" %}?next={% url "maraudes:create" pk=maraude.id %}', function () {
|
||||
$('.modal-title').text("Nouveau lieu");
|
||||
$('#form-modal').modal('toggle');
|
||||
formAjaxSubmit("#form-modal-body form", "#form-modal");
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="panel panel-primary">
|
||||
<!-- Default panel contents -->
|
||||
<div class="panel-heading text-center">
|
||||
<h3 class="panel-title">Maraudes</h3>
|
||||
<h3 class="panel-title">Maraudes passées</h3>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
@@ -24,8 +24,8 @@
|
||||
</a><a class="btn btn-danger" href="/admin/maraudes/maraude/{{maraude.id}}/change/">{% bootstrap_icon "edit" %}
|
||||
{% endif %}</a></div>
|
||||
<div class="pull-right">
|
||||
<span class="label label-info">{{ maraude.binome }} & {{ maraude.referent }}</span>
|
||||
<span class="label label-success">{{maraude.rencontres.count}} rencontres</span>
|
||||
<span class="label label-info">{{ maraude.binome }} & {{ maraude.referent }}</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
+27
-1
@@ -59,6 +59,26 @@ class IndexView(DerniereMaraudeMixin, generic.TemplateView):
|
||||
|
||||
template_name = "maraudes/index.html"
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['prochaine_maraude_abs'] = self.get_prochaine_maraude()
|
||||
context['prochaine_maraude'] = self.get_prochaine_maraude_for_user()
|
||||
return context
|
||||
|
||||
def get_prochaine_maraude_for_user(self):
|
||||
""" Retourne le prochain objet Maraude auquel
|
||||
l'utilisateur participe, ou None """
|
||||
try: #TODO: Clean up this ugly thing
|
||||
self.maraudeur = Maraudeur.objects.get(username=self.request.user.username)
|
||||
except:
|
||||
self.maraudeur = None
|
||||
|
||||
if self.maraudeur:
|
||||
return Maraude.objects.get_next_of(self.maraudeur)
|
||||
return None
|
||||
|
||||
def get_prochaine_maraude(self):
|
||||
return Maraude.objects.next
|
||||
|
||||
## MARAUDES
|
||||
@webpage
|
||||
@@ -112,6 +132,10 @@ class CompteRenduCreateView(generic.DetailView):
|
||||
header = "{{maraude.date}}"
|
||||
header_small = "écriture du compte-rendu"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.app_menu = ["compte_rendu/menu_creation.html"]
|
||||
|
||||
def get_forms(self, *args, initial=None):
|
||||
self.form = RencontreForm(*args,
|
||||
initial=initial)
|
||||
@@ -151,11 +175,13 @@ class CompteRenduCreateView(generic.DetailView):
|
||||
def calculate_end_time(debut, duree):
|
||||
end_minute = debut.minute + duree
|
||||
hour = debut.hour + end_minute // 60
|
||||
if hour >= 24: hour -= 24
|
||||
elif hour < 0: hour += 24
|
||||
minute = end_minute % 60
|
||||
return datetime.time(
|
||||
hour,
|
||||
minute,
|
||||
debut.second
|
||||
0
|
||||
)
|
||||
if new_form:
|
||||
last_rencontre = self.get_object().rencontres.last()
|
||||
|
||||
@@ -1,2 +1,21 @@
|
||||
<div class="col-md-6">{% include "suivi/sujet_suivi.html" %}</div>
|
||||
<div class="col-md-6">{% include "sujets/sujet_details_inner.html" %}</div>
|
||||
{% load bootstrap3 %}
|
||||
<div class="col-md-6">
|
||||
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
|
||||
{% include "suivi/sujet_suivi.html" %}
|
||||
<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">
|
||||
{% bootstrap_icon "plus" %} Ajouter une note
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div id="collapseNotesAjout" class="panel-collapse collapse" role="tabpanel" aria-labelledby="notesAjoutHeading">
|
||||
<div class="panel-body">
|
||||
Formulaire d'ajout d'une note
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"> {% include "sujets/sujet_details_inner.html" %}</div>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
{% load notes %}
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">Notes
|
||||
<span class="pull-right"><span class="label">Total : {{ notes.count }}</span></span></h3>
|
||||
<div class="panel-heading" role="tab" id="notesSujetHeading">
|
||||
<h3 class="panel-title">
|
||||
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseNotesSujet" aria-expanded="true" aria-controls="collapseOne">
|
||||
Notes</a><span class="pull-right label">Total : {{ notes.count }}</span></h3>
|
||||
</div>
|
||||
<div id="collapseNotesSujet" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="ficheInfoHeading">
|
||||
<table class="table table-striped table-bordered">
|
||||
{% for note in notes %}
|
||||
{% inline_table note header="date" %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<table class="table table-striped table-bordered">
|
||||
{% for note in notes %}
|
||||
{% inline_table note header="date" %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
{% include "sujets/sujet_create_inner.html" %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{% include "sujets/sujet_create_inner.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{% load bootstrap3 %}
|
||||
<div class="row"><div class="col-md-12">
|
||||
<form class="form-horizontal" action="{% url "sujets:create" %}" method="post">{% csrf_token %}
|
||||
{% bootstrap_form form layout="horizontal"%}
|
||||
{% bootstrap_button "Ajouter un sujet" button_type="submit" button_class="btn btn-primary" %}
|
||||
<div class="pull-right">
|
||||
{% bootstrap_button "Ajouter un sujet" button_type="submit" button_class="btn btn-primary" icon="plus" %}
|
||||
</div>
|
||||
{% if next %}<input type="text" hidden=True name="next" value="{{ next }}" />{%endif%}
|
||||
</form>
|
||||
</div></div>
|
||||
|
||||
@@ -1,22 +1,31 @@
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h3 class="panel-title">Fiche informations</h3></div>
|
||||
<div class="panel-body"><p class="label label-info">Première rencontre : {{ sujet.premiere_rencontre }}</p></div>
|
||||
<table class="table">
|
||||
<tr><th colspan="4" class="active">État-civil</th></tr>
|
||||
<tr><th>Nom</th><td>{{ sujet.nom|default:'?' }}</td><th>Prénom</th><td>{{ sujet.prenom|default:'?' }}</td></tr>
|
||||
<tr><th>Sexe</th><td>{{ sujet.genre }}</td><th>Âge</th><td>{{ sujet.age|default:'?' }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Problématiques</th></tr>
|
||||
<tr><th>Psychiatrique</th><td>{{ sujet.prob_psychiatrie }}</td><th>Addiction</th><td>{{ sujet.prob_addiction }}</td></tr>
|
||||
<tr><th>Administratif</th><td>{{ sujet.prob_administratif }}</td><th>Somatique</th><td>{{ sujet.prob_somatique }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Habitation</th></tr></td></tr>
|
||||
<tr><th>Type</th><td>{{ sujet.habitation }}</td><th>Connu du SIAO</th><td>{{ sujet.connu_siao }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Ressources</th></tr></td></tr>
|
||||
<tr><td colspan="4">{{ sujet.ressources }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Parcours de vie</th></tr></td></tr>
|
||||
<tr><td colspan="2">{{ sujet.parcours_de_vie }}</td><th>Lien familial</th><td>{{ sujet.lien_familial }}</td></tr>
|
||||
</table>
|
||||
<div class="panel-footer text-right">
|
||||
<a href="{% url "sujets:update" pk=sujet.id %}" class="btn btn-sm btn-default">Mettre à jour</a>
|
||||
<div class="panel-heading" role="tab" id="ficheInfoHeading">
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<h4 class="panel-title">
|
||||
<a role="button" data-toggle="collapse" href="#collapseFicheInfo" aria-expanded="true" aria-controls="collapseOne">
|
||||
Fiche informations</a></h4></div>
|
||||
<div class="col-md-3 text-right">
|
||||
<a href="{% url "sujets:update" pk=sujet.id %}" class="btn btn-sm btn-primary">Mettre à jour</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapseFicheInfo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="ficheInfoHeading">
|
||||
<div class="panel-body"><p class="label label-info">Première rencontre : {{ sujet.premiere_rencontre }}</p></div>
|
||||
<table class="table">
|
||||
<tr><th colspan="4" class="active">État-civil</th></tr>
|
||||
<tr><th>Nom</th><td>{{ sujet.nom|default:'?' }}</td><th>Prénom</th><td>{{ sujet.prenom|default:'?' }}</td></tr>
|
||||
<tr><th>Sexe</th><td>{{ sujet.genre }}</td><th>Âge</th><td>{{ sujet.age|default:'?' }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Problématiques</th></tr>
|
||||
<tr><th>Psychiatrique</th><td>{{ sujet.prob_psychiatrie }}</td><th>Addiction</th><td>{{ sujet.prob_addiction }}</td></tr>
|
||||
<tr><th>Administratif</th><td>{{ sujet.prob_administratif }}</td><th>Somatique</th><td>{{ sujet.prob_somatique }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Habitation</th></tr></td></tr>
|
||||
<tr><th>Type</th><td>{{ sujet.habitation }}</td><th>Connu du SIAO</th><td>{{ sujet.connu_siao }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Ressources</th></tr></td></tr>
|
||||
<tr><td colspan="4">{{ sujet.ressources }}</td></tr>
|
||||
<tr><th colspan="4" class="active">Parcours de vie</th></tr></td></tr>
|
||||
<tr><td colspan="2">{{ sujet.parcours_de_vie }}</td><th>Lien familial</th><td>{{ sujet.lien_familial }}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
+13
-24
@@ -82,28 +82,22 @@ class WebsiteTemplateMixin(TemplateResponseMixin):
|
||||
self.app_name = self.__class__.__module__.split(".")[0]
|
||||
return apps.get_app_config(self.app_name)
|
||||
|
||||
@property
|
||||
def active_app(self):
|
||||
if not hasattr(self, '_active_app'):
|
||||
self._active_app = self.get_active_app()
|
||||
return self._active_app
|
||||
|
||||
def get_menu(self):
|
||||
""" Renvoie la liste des templates utilisés comme menu pour l'application
|
||||
active
|
||||
"""
|
||||
return self.app_menu
|
||||
|
||||
def get_prochaine_maraude_for_user(self):
|
||||
""" Retourne le prochain objet Maraude auquel
|
||||
l'utilisateur participe, ou None """
|
||||
maraudeur_cls = apps.get_model('utilisateurs', model_name="Maraudeur")
|
||||
maraude_cls = apps.get_model('maraudes', model_name="Maraude")
|
||||
try: #TODO: Clean up this ugly thing
|
||||
self.maraudeur = maraudeur_cls.objects.get(username=self.request.user.username)
|
||||
except:
|
||||
self.maraudeur = None
|
||||
|
||||
if self.maraudeur:
|
||||
return maraude_cls.objects.get_next_of(self.maraudeur)
|
||||
return None
|
||||
|
||||
def get_prochaine_maraude(self):
|
||||
return apps.get_model('maraudes', model_name="Maraude").objects.next
|
||||
def insert_menu(self, template_name):
|
||||
""" Insert menu at beginning of self.app_menu """
|
||||
if not template_name in self.app_menu:
|
||||
self.app_menu.insert(0, template_name)
|
||||
|
||||
def _update_context_with_rendered_blocks(self, context):
|
||||
""" Render text for existing PageInfo attributes.
|
||||
@@ -116,18 +110,13 @@ class WebsiteTemplateMixin(TemplateResponseMixin):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
self._update_context_with_rendered_blocks(context)
|
||||
context['stylesheets'] = self.Configuration.stylesheets
|
||||
context['apps'] = self.Configuration.apps
|
||||
context['active_app'] = self.get_active_app()
|
||||
|
||||
context['active_app'] = self.active_app
|
||||
#Webpage
|
||||
context['content_template'] = self.get_content_template()
|
||||
context['app_menu'] = self.get_menu()
|
||||
|
||||
context['prochaine_maraude_abs'] = self.get_prochaine_maraude()
|
||||
context['prochaine_maraude'] = self.get_prochaine_maraude_for_user()
|
||||
|
||||
self._update_context_with_rendered_blocks(context)
|
||||
return context
|
||||
|
||||
class WebsiteAjaxTemplateMixin(WebsiteTemplateMixin):
|
||||
|
||||
+15
-5
@@ -1,17 +1,27 @@
|
||||
|
||||
#menu {
|
||||
border: none;
|
||||
border-right: 4px solid #f47f02;
|
||||
border-right: 4px solid #980300;
|
||||
}
|
||||
|
||||
.dropdown-toggle{
|
||||
border-right: 4px solid #980300 !important;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
border-bottom: none !important;
|
||||
}
|
||||
|
||||
.navbar-fixed-side .navbar-nav>li>a {
|
||||
border-bottom: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.app-menu {
|
||||
background-color: #121212;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
padding-top:10px;
|
||||
border-bottom: 4px solid #f47f02;
|
||||
border-top: 4px solid #f47f02;
|
||||
@media (max-width:768px){
|
||||
#menu { border: none; }
|
||||
}
|
||||
|
||||
@@ -164,12 +164,12 @@
|
||||
"@navbar-default-toggle-border-color": "#ddd",
|
||||
"@navbar-inverse-color": "lighten(@gray-light, 15%)",
|
||||
"@navbar-inverse-bg": "#222",
|
||||
"@navbar-inverse-border": "#f47f02",
|
||||
"@navbar-inverse-border": "#333",
|
||||
"@navbar-inverse-link-color": "lighten(@gray-light, 15%)",
|
||||
"@navbar-inverse-link-hover-color": "#fff",
|
||||
"@navbar-inverse-link-hover-bg": "transparent",
|
||||
"@navbar-inverse-link-active-color": "@navbar-inverse-link-hover-color",
|
||||
"@navbar-inverse-link-active-bg": "#f47f02",
|
||||
"@navbar-inverse-link-active-bg": "@brand-primary",
|
||||
"@navbar-inverse-link-disabled-color": "#444",
|
||||
"@navbar-inverse-link-disabled-bg": "transparent",
|
||||
"@navbar-inverse-brand-color": "@navbar-inverse-link-color",
|
||||
@@ -379,7 +379,7 @@
|
||||
"@page-header-border-color": "@hr-border",
|
||||
"@dl-horizontal-offset": "@component-offset-horizontal",
|
||||
"@dl-horizontal-breakpoint": "@grid-float-breakpoint",
|
||||
"@hr-border": "@gray-light"
|
||||
"@hr-border": "lighten(@gray-base, 83.5%)"
|
||||
},
|
||||
"css": [
|
||||
"print.less",
|
||||
@@ -431,5 +431,5 @@
|
||||
"scrollspy.js",
|
||||
"transition.js"
|
||||
],
|
||||
"customizerUrl": "http://getbootstrap.com/customize/?id=3e0cac7da17e620f3ce026228727422b"
|
||||
"customizerUrl": "https://getbootstrap.com/customize/?id=4e370b35f1630f31fde8e0de59c1c6f5"
|
||||
}
|
||||
+7
-7
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=3e0cac7da17e620f3ce026228727422b)
|
||||
* Config saved to config.json and https://gist.github.com/3e0cac7da17e620f3ce026228727422b
|
||||
* Generated using the Bootstrap Customizer (https://getbootstrap.com/customize/?id=4e370b35f1630f31fde8e0de59c1c6f5)
|
||||
* Config saved to config.json and https://gist.github.com/4e370b35f1630f31fde8e0de59c1c6f5
|
||||
*/
|
||||
/*!
|
||||
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||
@@ -384,12 +384,12 @@ fieldset[disabled] .btn-danger.active {
|
||||
}
|
||||
.navbar-inverse .navbar-nav > .open > a,
|
||||
.navbar-inverse .navbar-nav > .active > a {
|
||||
background-image: -webkit-linear-gradient(top, #f47f02 0%, #fd8506 100%);
|
||||
background-image: -o-linear-gradient(top, #f47f02 0%, #fd8506 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#f47f02), to(#fd8506));
|
||||
background-image: linear-gradient(to bottom, #f47f02 0%, #fd8506 100%);
|
||||
background-image: -webkit-linear-gradient(top, #980300 0%, #a50300 100%);
|
||||
background-image: -o-linear-gradient(top, #980300 0%, #a50300 100%);
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, from(#980300), to(#a50300));
|
||||
background-image: linear-gradient(to bottom, #980300 0%, #a50300 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff47f02', endColorstr='#fffd8506', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff980300', endColorstr='#ffa50300', GradientType=0);
|
||||
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
+10
-10
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=3e0cac7da17e620f3ce026228727422b)
|
||||
* Config saved to config.json and https://gist.github.com/3e0cac7da17e620f3ce026228727422b
|
||||
* Generated using the Bootstrap Customizer (https://getbootstrap.com/customize/?id=4e370b35f1630f31fde8e0de59c1c6f5)
|
||||
* Config saved to config.json and https://gist.github.com/4e370b35f1630f31fde8e0de59c1c6f5
|
||||
*/
|
||||
/*!
|
||||
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||
@@ -1153,7 +1153,7 @@ hr {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
border: 0;
|
||||
border-top: 1px solid #777777;
|
||||
border-top: 1px solid #d5d5d5;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
@@ -1416,7 +1416,7 @@ a.bg-danger:focus {
|
||||
.page-header {
|
||||
padding-bottom: 9px;
|
||||
margin: 40px 0 20px;
|
||||
border-bottom: 1px solid #777777;
|
||||
border-bottom: 1px solid #d5d5d5;
|
||||
}
|
||||
ul,
|
||||
ol {
|
||||
@@ -4596,7 +4596,7 @@ fieldset[disabled] .navbar-default .btn-link:focus {
|
||||
}
|
||||
.navbar-inverse {
|
||||
background-color: #222222;
|
||||
border-color: #f47f02;
|
||||
border-color: #333333;
|
||||
}
|
||||
.navbar-inverse .navbar-brand {
|
||||
color: #9d9d9d;
|
||||
@@ -4621,7 +4621,7 @@ fieldset[disabled] .navbar-default .btn-link:focus {
|
||||
.navbar-inverse .navbar-nav > .active > a:hover,
|
||||
.navbar-inverse .navbar-nav > .active > a:focus {
|
||||
color: #ffffff;
|
||||
background-color: #f47f02;
|
||||
background-color: #980300;
|
||||
}
|
||||
.navbar-inverse .navbar-nav > .disabled > a,
|
||||
.navbar-inverse .navbar-nav > .disabled > a:hover,
|
||||
@@ -4646,15 +4646,15 @@ fieldset[disabled] .navbar-default .btn-link:focus {
|
||||
.navbar-inverse .navbar-nav > .open > a,
|
||||
.navbar-inverse .navbar-nav > .open > a:hover,
|
||||
.navbar-inverse .navbar-nav > .open > a:focus {
|
||||
background-color: #f47f02;
|
||||
background-color: #980300;
|
||||
color: #ffffff;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {
|
||||
border-color: #f47f02;
|
||||
border-color: #333333;
|
||||
}
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu .divider {
|
||||
background-color: #f47f02;
|
||||
background-color: #333333;
|
||||
}
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
|
||||
color: #9d9d9d;
|
||||
@@ -4668,7 +4668,7 @@ fieldset[disabled] .navbar-default .btn-link:focus {
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {
|
||||
color: #ffffff;
|
||||
background-color: #f47f02;
|
||||
background-color: #980300;
|
||||
}
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,
|
||||
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
+2
-2
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Generated using the Bootstrap Customizer (http://getbootstrap.com/customize/?id=3e0cac7da17e620f3ce026228727422b)
|
||||
* Config saved to config.json and https://gist.github.com/3e0cac7da17e620f3ce026228727422b
|
||||
* Generated using the Bootstrap Customizer (https://getbootstrap.com/customize/?id=4e370b35f1630f31fde8e0de59c1c6f5)
|
||||
* Config saved to config.json and https://gist.github.com/4e370b35f1630f31fde8e0de59c1c6f5
|
||||
*/
|
||||
if (typeof jQuery === 'undefined') {
|
||||
throw new Error('Bootstrap\'s JavaScript requires jQuery')
|
||||
|
||||
+2
-2
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
|
||||
$(function() {
|
||||
|
||||
var input = $('#id_heure_debut')
|
||||
var min_value = input.attr('value').split(":")
|
||||
var is_morning = (min_value[0] <= 12)
|
||||
$.fn.editHeureValue = function(mod) {
|
||||
var value = input.attr('value').split(":");
|
||||
var new_hour = parseInt(value[0]);
|
||||
var new_minutes = parseInt(value[1]) + mod;
|
||||
if (new_minutes >= 60) {
|
||||
new_hour += 1;
|
||||
new_minutes -= 60;
|
||||
} else if (new_minutes < 0) {
|
||||
new_hour -= 1;
|
||||
new_minutes += 60;
|
||||
};
|
||||
if (new_hour >= 24) {
|
||||
new_hour -= 24;
|
||||
} else if (new_hour < 0) {
|
||||
new_hour += 24
|
||||
};
|
||||
value[0] = new_hour;
|
||||
value[1] = new_minutes;
|
||||
var test_value = value[0] * 10000 + value[1] * 100 + parseInt(value[2]);
|
||||
var test_min_value = min_value[0] * 10000 + min_value[1] *100 + parseInt(min_value[2]);
|
||||
console.log('test:', test_value, 'min:', test_min_value)
|
||||
if (test_value >= test_min_value || (!is_morning && test_value < 120000)) {
|
||||
input.attr('value', value.join(":"));
|
||||
console.log('updated!')
|
||||
};
|
||||
};
|
||||
|
||||
$('#minus-5').click(function() {
|
||||
$.fn.editHeureValue(-5)
|
||||
console.log('minus 5')
|
||||
});
|
||||
$('#plus-5').click(function() {
|
||||
$.fn.editHeureValue(5)
|
||||
console.log('plus 5')
|
||||
});
|
||||
});
|
||||
@@ -3,9 +3,9 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<title>{% block title %}La maraude{% endblock %}</title>
|
||||
{# Load Bootstrap CSS and JavaScript #}{% bootstrap_css %}{% bootstrap_javascript %}
|
||||
{# Side Navbar from http://www.samrayner.com/bootstrap-side-navbar/inverse.html #}<link href="/static/bootstrap/navbar-fixed-side.css" rel="stylesheet" />
|
||||
{% if stylesheets %}{% for stylesheet in stylesheets %}<link rel="stylesheet" type="text/css" href="{% static stylesheet %}" />{% endfor %}{% endif %}
|
||||
{# Load CSS and JavaScript #}{% bootstrap_css %}{% bootstrap_javascript %}
|
||||
<link href="/static/bootstrap/navbar-fixed-side.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav">{% for app in apps %}
|
||||
<li {% if app == active_app %} class="active" {%endif%}>
|
||||
<a href="/{{app.label}}/"><strong style="color:#fff;">{{ app.name|title }}</strong></a>
|
||||
<a href="/{{app.label}}/"><strong>{{ app.name|title }}</strong></a>
|
||||
</li>
|
||||
{% if app == active_app %}{% for t in app_menu %}{% include t %}{% endfor %}{% endif %}
|
||||
{%endfor%}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class Index(WebsiteTemplateMixin, views.generic.TemplateView):
|
||||
class PageInfo:
|
||||
title = "La maraude ALSA"
|
||||
header = "La Maraude ALSA"
|
||||
header_small = "informations"
|
||||
header_small = "accueil"
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
if not request.user.is_authenticated():
|
||||
|
||||
Reference in New Issue
Block a user