mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 08:22:10 +01:00 
			
		
		
		
	Admin can see note details
This commit is contained in:
		@@ -41,9 +41,11 @@
 | 
				
			|||||||
                </dd>
 | 
					                </dd>
 | 
				
			||||||
            </dl>
 | 
					            </dl>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        {% if user.registration.is_admin %}
 | 
					        {% if notes is not None %}
 | 
				
			||||||
            <div class="card-footer text-center">
 | 
					            <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>
 | 
					                <button class="btn btn-primary" data-toggle="modal" data-target="#updatePassageModal">{% trans "Update" %}</button>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        {% elif user.registration.participates %}
 | 
					        {% elif user.registration.participates %}
 | 
				
			||||||
@@ -98,16 +100,18 @@
 | 
				
			|||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
    {% endif %}
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    {% if user.registration.is_admin %}
 | 
					    {% if notes is not None %}
 | 
				
			||||||
        {% trans "Update passage" as modal_title %}
 | 
					        {% trans "Update passage" as modal_title %}
 | 
				
			||||||
        {% trans "Update" as modal_button %}
 | 
					        {% trans "Update" as modal_button %}
 | 
				
			||||||
        {% url "participation:passage_update" pk=passage.pk as modal_action %}
 | 
					        {% url "participation:passage_update" pk=passage.pk as modal_action %}
 | 
				
			||||||
        {% include "base_modal.html" with modal_id="updatePassage" %}
 | 
					        {% include "base_modal.html" with modal_id="updatePassage" %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        {% trans "Update notes" as modal_title %}
 | 
					        {% if my_note is not None %}
 | 
				
			||||||
        {% trans "Update" as modal_button %}
 | 
					            {% trans "Update notes" as modal_title %}
 | 
				
			||||||
        {% url "participation:update_notes" pk=my_note.pk as modal_action %}
 | 
					            {% trans "Update" as modal_button %}
 | 
				
			||||||
        {% include "base_modal.html" with modal_id="updateNotes" %}
 | 
					            {% url "participation:update_notes" pk=my_note.pk as modal_action %}
 | 
				
			||||||
 | 
					            {% include "base_modal.html" with modal_id="updateNotes" %}
 | 
				
			||||||
 | 
					        {% endif %}
 | 
				
			||||||
    {% elif user.registration.participates %}
 | 
					    {% elif user.registration.participates %}
 | 
				
			||||||
        {% trans "Upload synthesis" as modal_title %}
 | 
					        {% trans "Upload synthesis" as modal_title %}
 | 
				
			||||||
        {% trans "Upload" as modal_button %}
 | 
					        {% trans "Upload" as modal_button %}
 | 
				
			||||||
@@ -119,18 +123,20 @@
 | 
				
			|||||||
{% block extrajavascript %}
 | 
					{% block extrajavascript %}
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        $(document).ready(function () {
 | 
					        $(document).ready(function () {
 | 
				
			||||||
            {% if user.registration.is_admin %}
 | 
					            {% if notes is not None %}
 | 
				
			||||||
                $('button[data-target="#updatePassageModal"]').click(function() {
 | 
					                $('button[data-target="#updatePassageModal"]').click(function() {
 | 
				
			||||||
                    let modalBody = $("#updatePassageModal div.modal-body");
 | 
					                    let modalBody = $("#updatePassageModal div.modal-body");
 | 
				
			||||||
                    if (!modalBody.html().trim())
 | 
					                    if (!modalBody.html().trim())
 | 
				
			||||||
                        modalBody.load("{% url "participation:passage_update" pk=passage.pk %} #form-content")
 | 
					                        modalBody.load("{% url "participation:passage_update" pk=passage.pk %} #form-content")
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $('button[data-target="#updateNotesModal"]').click(function() {
 | 
					                {% if my_note is not None %}
 | 
				
			||||||
                    let modalBody = $("#updateNotesModal div.modal-body");
 | 
					                    $('button[data-target="#updateNotesModal"]').click(function() {
 | 
				
			||||||
                    if (!modalBody.html().trim())
 | 
					                        let modalBody = $("#updateNotesModal div.modal-body");
 | 
				
			||||||
                        modalBody.load("{% url "participation:update_notes" pk=my_note.pk %} #form-content")
 | 
					                        if (!modalBody.html().trim())
 | 
				
			||||||
                });
 | 
					                            modalBody.load("{% url "participation:update_notes" pk=my_note.pk %} #form-content")
 | 
				
			||||||
 | 
					                    });
 | 
				
			||||||
 | 
					                {% endif %}
 | 
				
			||||||
            {% elif user.registration.participates %}
 | 
					            {% elif user.registration.participates %}
 | 
				
			||||||
                $('button[data-target="#uploadSynthesisModal"]').click(function() {
 | 
					                $('button[data-target="#uploadSynthesisModal"]').click(function() {
 | 
				
			||||||
                    let modalBody = $("#uploadSynthesisModal div.modal-body");
 | 
					                    let modalBody = $("#uploadSynthesisModal div.modal-body");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -704,6 +704,8 @@ class PassageDetailView(LoginRequiredMixin, DetailView):
 | 
				
			|||||||
        if self.request.user.registration in self.object.pool.juries.all():
 | 
					        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["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])
 | 
					            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
 | 
					        return context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user