1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-23 18:21:18 +00:00

Compare commits

..

3 Commits

Author SHA1 Message Date
7dd85d7402
Update defender penalties 2021-04-04 13:35:45 +02:00
6b2ca1d2e1
Admin can see note details 2021-04-04 13:30:02 +02:00
fbedb941be
Better pool display 2021-04-04 13:15:00 +02:00
4 changed files with 26 additions and 18 deletions

View File

@ -202,7 +202,7 @@ class PassageForm(forms.ModelForm):
class Meta:
model = Passage
fields = ('solution_number', 'place', 'defender', 'opponent', 'reporter',)
fields = ('solution_number', 'place', 'defender', 'opponent', 'reporter', 'defender_penalties',)
class SynthesisForm(forms.ModelForm):

View File

@ -107,20 +107,20 @@ class PassageTable(tables.Table):
)
def render_defender(self, value):
return value.team
return value.team.trigram
def render_opponent(self, value):
return value.team
return value.team.trigram
def render_reporter(self, value):
return value.team
return value.team.trigram
class Meta:
attrs = {
'class': 'table table-condensed table-striped text-center',
}
model = Passage
fields = ('defender', 'opponent', 'reporter', 'place',)
fields = ('defender', 'opponent', 'reporter', 'solution_number', 'place',)
template_name = 'django_tables2/bootstrap4.html'

View File

@ -41,9 +41,11 @@
</dd>
</dl>
</div>
{% if user.registration.is_admin %}
{% if notes is not None %}
<div class="card-footer text-center">
<button class="btn btn-info" data-toggle="modal" data-target="#updateNotesModal">{% trans "Update notes" %}</button>
{% if my_note is not None %}
<button class="btn btn-info" data-toggle="modal" data-target="#updateNotesModal">{% trans "Update notes" %}</button>
{% endif %}
<button class="btn btn-primary" data-toggle="modal" data-target="#updatePassageModal">{% trans "Update" %}</button>
</div>
{% elif user.registration.participates %}
@ -98,16 +100,18 @@
</div>
{% endif %}
{% if user.registration.is_admin %}
{% if notes is not None %}
{% trans "Update passage" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:passage_update" pk=passage.pk as modal_action %}
{% include "base_modal.html" with modal_id="updatePassage" %}
{% trans "Update notes" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_notes" pk=my_note.pk as modal_action %}
{% include "base_modal.html" with modal_id="updateNotes" %}
{% if my_note is not None %}
{% trans "Update notes" as modal_title %}
{% trans "Update" as modal_button %}
{% url "participation:update_notes" pk=my_note.pk as modal_action %}
{% include "base_modal.html" with modal_id="updateNotes" %}
{% endif %}
{% elif user.registration.participates %}
{% trans "Upload synthesis" as modal_title %}
{% trans "Upload" as modal_button %}
@ -119,18 +123,20 @@
{% block extrajavascript %}
<script>
$(document).ready(function () {
{% if user.registration.is_admin %}
{% if notes is not None %}
$('button[data-target="#updatePassageModal"]').click(function() {
let modalBody = $("#updatePassageModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:passage_update" pk=passage.pk %} #form-content")
});
$('button[data-target="#updateNotesModal"]').click(function() {
let modalBody = $("#updateNotesModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:update_notes" pk=my_note.pk %} #form-content")
});
{% if my_note is not None %}
$('button[data-target="#updateNotesModal"]').click(function() {
let modalBody = $("#updateNotesModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "participation:update_notes" pk=my_note.pk %} #form-content")
});
{% endif %}
{% elif user.registration.participates %}
$('button[data-target="#uploadSynthesisModal"]').click(function() {
let modalBody = $("#uploadSynthesisModal div.modal-body");

View File

@ -704,6 +704,8 @@ class PassageDetailView(LoginRequiredMixin, DetailView):
if self.request.user.registration in self.object.pool.juries.all():
context["my_note"] = Note.objects.get(passage=self.object, jury=self.request.user.registration)
context["notes"] = NoteTable([note for note in self.object.notes.all() if note])
elif self.request.user.registration.is_admin:
context["notes"] = NoteTable([note for note in self.object.notes.all() if note])
return context