diff --git a/stages/static/img/closed.png b/stages/static/img/closed.png new file mode 100644 index 0000000..7323a89 Binary files /dev/null and b/stages/static/img/closed.png differ diff --git a/stages/static/img/open.png b/stages/static/img/open.png new file mode 100644 index 0000000..25e1aa4 Binary files /dev/null and b/stages/static/img/open.png differ diff --git a/stages/static/js/attribution.js b/stages/static/js/attribution.js index 2056a06..f04b2d7 100644 --- a/stages/static/js/attribution.js +++ b/stages/static/js/attribution.js @@ -128,7 +128,15 @@ $(document).ready(function() { }); $('#student_select').change(function(ev) { - $('#student_detail').load('/student/' + $(this).val() + '/summary/').addClass("filled"); + $('#student_detail').load('/student/' + $(this).val() + '/summary/', function() { + $('div#previous_stages_head').toggle(function() { + $('ul#previous_stages_list').toggle(); + $(this).find('img').attr('src', static_url + 'img/open.png'); + }, function() { + $('ul#previous_stages_list').toggle(); + $(this).find('img').attr('src', static_url + 'img/closed.png'); + }); + }).addClass("filled"); current_student = $(this).val(); if (current_avail !== null) $('input#valid_training').show() }); diff --git a/stages/views.py b/stages/views.py index 25416e1..e491ab3 100644 --- a/stages/views.py +++ b/stages/views.py @@ -15,6 +15,12 @@ class StudentSummaryView(DetailView): model = Student template_name = 'student_summary.html' + def get_context_data(self, **kwargs): + context = super(StudentSummaryView, self).get_context_data(**kwargs) + context['previous_stages'] = self.object.training_set.all( + ).select_related('availability__corporation').order_by('availability__period__end_date') + return context + class AvailabilitySummaryView(DetailView): model = Availability diff --git a/templates/attribution.html b/templates/attribution.html index bf7fbc1..4b02668 100644 --- a/templates/attribution.html +++ b/templates/attribution.html @@ -15,6 +15,9 @@ select#corp_select, select#corp_filter { width: 100%; } div#student_detail { float:left; width: 40%; margin: 1em; padding: 0.5em; border: 3px solid red; min-height: 4em; border-radius: 8px; } + div#previous_stages { background-color: #EEE; border-radius: 4px; } + ul#previous_stages_list { display: none; padding-left: 1.5em;} + div#corp_detail { float:right; width: 40%; margin: 1em; padding: 0.5em; border: 3px solid red; min-height: 4em; border-radius: 8px; } div#corp_total, div#student_total { font-style: italic; color: gray; } div.filled { border-color: green !important; } @@ -33,6 +36,7 @@ {% block extrahead %} + {% endblock %} {% block breadcrumbs %} diff --git a/templates/student_summary.html b/templates/student_summary.html index 1b8dea1..7a09d1c 100644 --- a/templates/student_summary.html +++ b/templates/student_summary.html @@ -1,3 +1,16 @@ -{{ object.first_name }} {{ object.last_name }}
-{{ object.pcode }} {{ object.city }}
-Date de naissance: {{ object.birth_date }} +
+
+ Stages précédents ({{ previous_stages|length }}) : +
+ +
+ +
+ {{ object.first_name }} {{ object.last_name }}
+ {{ object.pcode }} {{ object.city }}
+ Date de naissance: {{ object.birth_date }} +