prepared to work on menu logic

This commit is contained in:
Arthur Gerbaud
2016-11-19 14:25:09 +01:00
parent 23d9da9a79
commit f4f366f514
10 changed files with 50 additions and 26 deletions

View File

@@ -0,0 +1,12 @@
{% if user.is_superuser %}
{% load bootstrap3 %}
<li class="dropdown app-menu">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Administration <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><a href="{% url 'sujets:create' %}">{% bootstrap_icon "plus" %} Nouveau sujet</a></li>
<li><a href="{% url 'admin:app_list' app_label='sujets' %}">
{% bootstrap_icon "wrench" %} Gérer les sujets</a></li>
</ul>
{% endif %}

View File

@@ -0,0 +1,6 @@
{% load bootstrap3 %}
<li class="app-menu">
<a href="{% url 'sujets:liste' %}">Liste des sujets
<span class="pull-right">{% bootstrap_icon "list" %}</span>
</a>
</li>

View File

@@ -12,7 +12,7 @@ from website import decorators as website
webpage = website.webpage(
ajax=False,
app_users=[Maraudeur],
app_menu=["suivi/menu_sujets.html"]
app_menu=["suivi/menu/sujets.html", "suivi/menu/admin_sujets.html"]
)

View File

@@ -0,0 +1,7 @@
{% if user.is_superuser %}
{% load bootstrap3 %}
<li class="dropdown app-menu"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Sujet<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{% url 'admin:notes_note_changelist' %}?sujet__personne_ptr__exact={{sujet.pk}}">{% bootstrap_icon "wrench" %} Éditer les notes</a></li>
</ul>
{% endif %}

View File

@@ -1,6 +0,0 @@
{% if user.is_superuser %}{% load bootstrap3 %}
<li class="dropdown app-menu"><a class="dropdown-toggle" data-toggle="dropdown" href="#">Sujet<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="{% url 'admin:notes_note_changelist' %}?sujet__personne_ptr__exact={{sujet.pk}}">{% bootstrap_icon "wrench" %} Éditer les notes</a></li>
</ul>
{% endif %}

View File

@@ -1,10 +1,13 @@
<h4>Informations générales</h4>
<p><strong>Première rencontre :</strong> {{ sujet.premiere_rencontre }}</p>
<div class="panel panel-primary">
<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>
Fiche statistiques</a>
</h4>
</div>
<div class="col-md-3 text-right">
@@ -12,7 +15,7 @@
</div>
</div>
</div>
<div id="collapseFicheInfo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="ficheInfoHeading">
<div id="collapseFicheInfo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="ficheInfoHeading">
{% include 'sujets/sujet_details_inner.html' %}
</div>
</div>
@@ -51,7 +54,7 @@
var showUpdateDetails = function(button, panel) {
$(panel).load("{% url "sujets:details" pk=sujet.pk %}", function() {
$(button).text("Mise à jour");
$(button).text("Mettre à jour");
});
};

View File

@@ -1,4 +1,3 @@
<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>

View File

@@ -11,7 +11,7 @@ webpage = website.webpage(
ajax=True,
app_users=[Maraudeur],
app_name="suivi",
app_menu=[]
app_menu=["sujets/menu/admin_sujet.html"]
)
### Views
@@ -20,7 +20,7 @@ class SujetDetailsView(generic.DetailView):
class PageInfo:
title = "Sujet - {{ sujet }}"
header = "{{ sujet }}"
header_small = "suivi"
header_small = "informations"
#DetailView
template_name = "sujets/sujet_details.html"
model = Sujet
@@ -38,7 +38,7 @@ class SujetListView(generic.ListView):
paginate_by = 30
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.insert_menu("suivi/menu_sujets.html")
self.insert_menu("sujets/menu/admin_sujet.html")
def post(self, request, **kwargs):
from watson import search as watson
search_text = request.POST.get('q')

View File

@@ -94,8 +94,11 @@ class WebsiteTemplateMixin(TemplateResponseMixin):
return [self.base_template]
def get_content_template(self):
if hasattr(self, 'template_name'): #Ensure easy integration with other views
# Ensure easy integration with generic views
if hasattr(self, 'template_name'):
self.content_template = self.template_name
else:
raise ImproperlyConfigured(self, "has no template defined !")
return self.content_template
def get_apps_config(self):