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

Compare commits

..

No commits in common. "7dd85d74025b44b7e6fad5960d77e61fd6c26dfb" and "46e75c7ae84fafae89de452c9c6e14724ce7b7a8" have entirely different histories.

4 changed files with 18 additions and 26 deletions

View File

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

View File

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

View File

@ -41,11 +41,9 @@
</dd>
</dl>
</div>
{% if notes is not None %}
{% if user.registration.is_admin %}
<div class="card-footer text-center">
{% 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-info" data-toggle="modal" data-target="#updateNotesModal">{% trans "Update notes" %}</button>
<button class="btn btn-primary" data-toggle="modal" data-target="#updatePassageModal">{% trans "Update" %}</button>
</div>
{% elif user.registration.participates %}
@ -100,18 +98,16 @@
</div>
{% endif %}
{% if notes is not None %}
{% if user.registration.is_admin %}
{% 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" %}
{% 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 %}
{% 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" %}
{% elif user.registration.participates %}
{% trans "Upload synthesis" as modal_title %}
{% trans "Upload" as modal_button %}
@ -123,20 +119,18 @@
{% block extrajavascript %}
<script>
$(document).ready(function () {
{% if notes is not None %}
{% if user.registration.is_admin %}
$('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")
});
{% 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 %}
$('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")
});
{% elif user.registration.participates %}
$('button[data-target="#uploadSynthesisModal"]').click(function() {
let modalBody = $("#uploadSynthesisModal div.modal-body");

View File

@ -704,8 +704,6 @@ 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