From 7b38542309fbe17a5bc1ea00f5704171b660719d Mon Sep 17 00:00:00 2001 From: dzhuang <dzhuang.scut@gmail.com> Date: Tue, 27 Feb 2018 09:34:45 +0800 Subject: [PATCH] Adjust/allow override staff menu in templates/base.html --- course/templates/course/course-base.html | 40 ++++++------ relate/templates/base.html | 80 +++++++++++++----------- 2 files changed, 65 insertions(+), 55 deletions(-) diff --git a/course/templates/course/course-base.html b/course/templates/course/course-base.html index ff0e31a0..64933ccc 100644 --- a/course/templates/course/course-base.html +++ b/course/templates/course/course-base.html @@ -26,26 +26,26 @@ {% endblock %} {% if not relate_exam_lockdown and pperm.view_calendar %} - <li class="dropdown"> - {% comment %} Translators: The following are names for menu items in course page {% endcomment %} - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Participant" context "menu item" %}<b class="caret"></b></a> - <ul class="dropdown-menu"> - {% if course.course_xmpp_id and pperm.send_instant_message %} - <li><a href="{% url "relate-send_instant_message" course.identifier %}">{% trans "Send instant message" %}</a></li> - {% endif %} - {% if not request.user.is_anonymous %} - <li><a href="{% url "relate-view_participant_grades" course.identifier %}">{% trans "View grades" %}</a></li> - {% endif %} - {% if pperm.view_calendar %} - <li><a href="{% url "relate-view_calendar" course.identifier %}">{% trans "View calendar" %}</a></li> - {% endif %} - <li><a href="{% url "relate-course_page" course.identifier %}">{% trans "Back to course page" %}</a></li> - {% if pperm.view_analytics %} - <li role="presentation" class="divider"></li> - <li><a href="{% url "relate-manage_authentication_tokens" course.identifier %}">{% trans "Manage Authentication Tokens" %}</a></li> - {% endif %} - </ul> - </li> + <li class="dropdown"> + {% comment %} Translators: The following are names for menu items in course page {% endcomment %} + <a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Participant" context "menu item" %}<b class="caret"></b></a> + <ul class="dropdown-menu"> + {% if course.course_xmpp_id and pperm.send_instant_message %} + <li><a href="{% url "relate-send_instant_message" course.identifier %}">{% trans "Send instant message" %}</a></li> + {% endif %} + {% if not request.user.is_anonymous %} + <li><a href="{% url "relate-view_participant_grades" course.identifier %}">{% trans "View grades" %}</a></li> + {% endif %} + {% if pperm.view_calendar %} + <li><a href="{% url "relate-view_calendar" course.identifier %}">{% trans "View calendar" %}</a></li> + {% endif %} + <li><a href="{% url "relate-course_page" course.identifier %}">{% trans "Back to course page" %}</a></li> + {% if pperm.view_analytics %} + <li role="presentation" class="divider"></li> + <li><a href="{% url "relate-manage_authentication_tokens" course.identifier %}">{% trans "Manage Authentication Tokens" %}</a></li> + {% endif %} + </ul> + </li> {% endif %} {% if pperm.view_gradebook %} diff --git a/relate/templates/base.html b/relate/templates/base.html index 79ecaca0..62ba95c5 100644 --- a/relate/templates/base.html +++ b/relate/templates/base.html @@ -78,41 +78,51 @@ {% block navbar %}{% endblock %} - {% if user.is_staff or currently_impersonating or perms.course.can_issue_exam_tickets or pperm.impersonate_role or pperm.set_fake_time or pperm.set_pretend_facility %} - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Staff" %}<b class="caret"></b></a> - <ul class="dropdown-menu"> - {% if user.is_staff %} - <li><a href="/admin" target="_blank">{% trans "Admin site" %}</a></li> - <li role="presentation" class="divider"></li> - {% endif %} - {% if user.is_superuser or pperm.use_admin_interface %} - <li><a href="{% url 'relate-purge_page_view_data' %}" target="_blank">{% trans "Purge page view data" %}</a></li> - <li role="presentation" class="divider"></li> - {% endif %} - {% if perms.course.can_issue_exam_tickets %} - <li role="presentation" class="dropdown-header">{% trans "Exams" %}</li> - <li><a href="{% url 'relate-issue_exam_ticket' %}">{% trans "Issue exam tickets" %}</a></li> - <li><a href="{% url 'relate-check_in_for_exam' %}">{% trans "Exam check-in" %}</a></li> - <li role="presentation" class="divider"></li> - {% endif %} - {% if currently_impersonating or pperm.impersonate_role %} - <li role="presentation" class="dropdown-header">{% trans "Test/Troubleshoot" %}</li> - {% if currently_impersonating %} - <li><a href="{% url 'relate-stop_impersonating' %}" target="_blank">{% trans "Stop impersonating" %}</a></li> - {% else %} - <li><a href="{% url 'relate-impersonate' %}" target="_blank">{% trans "Impersonate user" %}</a></li> - {% endif %} - {% endif %} - {% if pperm.set_fake_time %} - <li><a href="{% url 'relate-set_fake_time' %}" target="_blank">{% trans "Set fake time" %}</a></li> - {% endif %} - {% if pperm.set_pretend_facility %} - <li><a href="{% url 'relate-set_pretend_facilities' %}" target="_blank">{% trans "Pretend to be in facilities" %}</a></li> - {% endif %} - </ul> - </li> - {% endif %} + {% block navbar_dropdown_staff %} + {% if user.is_staff or currently_impersonating or perms.course.can_issue_exam_tickets or pperm.impersonate_role or pperm.set_fake_time or pperm.set_pretend_facility %} + <li class="dropdown"> + <a href="#" class="dropdown-toggle" data-toggle="dropdown">{% trans "Staff" %}<b class="caret"></b></a> + <ul class="dropdown-menu"> + {% block navbar_dropdown_staff_menu_admin %} + {% if user.is_staff %} + <li><a href="/admin" target="_blank">{% trans "Admin site" %}</a></li> + {% endif %} + {% endblock %} + {% block navbar_dropdown_staff_menu_purge_page_view_data %} + {% if user.is_superuser or pperm.use_admin_interface %} + <li role="presentation" class="divider"></li> + <li><a href="{% url 'relate-purge_page_view_data' %}" target="_blank">{% trans "Purge page view data" %}</a></li> + {% endif %} + {% endblock %} + {% block navbar_dropdown_staff_menu_exam %} + {% if perms.course.can_issue_exam_tickets %} + <li role="presentation" class="divider"></li> + <li role="presentation" class="dropdown-header">{% trans "Exams" %}</li> + <li><a href="{% url 'relate-issue_exam_ticket' %}">{% trans "Issue exam tickets" %}</a></li> + <li><a href="{% url 'relate-check_in_for_exam' %}">{% trans "Exam check-in" %}</a></li> + {% endif %} + {% endblock %} + {% block navbar_dropdown_staff_menu_trouble_shoot %} + {% if currently_impersonating or pperm.impersonate_role or pperm.set_fake_time %} + <li role="presentation" class="divider"></li> + <li role="presentation" class="dropdown-header">{% trans "Test/Troubleshoot" %}</li> + {% if currently_impersonating %} + <li><a href="{% url 'relate-stop_impersonating' %}" target="_blank">{% trans "Stop impersonating" %}</a></li> + {% else %} + <li><a href="{% url 'relate-impersonate' %}" target="_blank">{% trans "Impersonate user" %}</a></li> + {% endif %} + {% if pperm.set_fake_time %} + <li><a href="{% url 'relate-set_fake_time' %}" target="_blank">{% trans "Set fake time" %}</a></li> + {% endif %} + {% if pperm.set_pretend_facility %} + <li><a href="{% url 'relate-set_pretend_facilities' %}" target="_blank">{% trans "Pretend to be in facilities" %}</a></li> + {% endif %} + {% endif %} + {% endblock %} + </ul> + </li> + {% endif %} + {% endblock %} </ul> <ul class="nav navbar-nav navbar-right"> {% block preview_status %} -- GitLab