Refactored some templates to reduce materials page permission lookups from ~2*#sessions to just a few.

- Legacy-Id: 16014
This commit is contained in:
Henrik Levkowetz 2019-03-07 23:25:02 +00:00
parent 9e36246a91
commit e52d1e68ec
3 changed files with 13 additions and 11 deletions

View file

@ -1,5 +1,5 @@
{% load ietf_filters session_filters %}
{% if session|can_manage_materials:user and not session.past_cutoff_date %}
{% if not session.past_cutoff_date %}
{% with gt=session.group.type_id %}
{%comment%}
<a class="button btn-default btn-sm" href="{% url 'ietf.meeting.views.session_details' num=session.meeting.number acronym=session.group.acronym %}{% if gt == 'wg' or gt == 'rg' or gt == 'ag' %}{% else %}#session_{{session.pk}}{% endif %}">Edit</a>

View file

@ -19,7 +19,7 @@
</td>
{% if session.status_id == 'canceled' %}
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<td colspan="6"><span class="label label-danger">Session cancelled</span></td>
{% else %}
<td colspan="5"><span class="label label-danger">Session cancelled</span></td>
@ -88,11 +88,11 @@
{{ session.last_update|utc|date:"Y-m-d" }}<br><small>{{ session.last_update|utc|date:"H:i:s" }}&nbsp;UTC</small>
{% endif %}
</td>
{% if user|has_role:"Secretariat" or user|matman_groups %}
<td>
<div>{% include "meeting/edit_materials_button.html" %}</div>
{% if user|has_role:"Secretariat" or session.group in user_groups %}
<div>{% include "meeting/edit_materials_button.html" %}</div>
{% endif %}
</td>
{% endif %}
{% endif %}
</tr>

View file

@ -14,6 +14,7 @@
{% block content %}
{% origin %}
{% with user|matman_groups as user_groups %}
<div class="row">
<div class="col-md-10">
@ -43,7 +44,7 @@
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<th class="col-md-1">Group</th>
<th class="col-md-1">Agenda</th>
<th class="col-md-1">Minutes</th>
@ -77,7 +78,7 @@
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<th class="col-md-1">Group</th>
<th class="col-md-1">Agenda</th>
<th class="col-md-1">Minutes</th>
@ -113,7 +114,7 @@
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<th class="col-md-1">Group</th>
<th class="col-md-1">Agenda</th>
<th class="col-md-1">Minutes</th>
@ -149,7 +150,7 @@
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<th class="col-md-1">Group</th>
<th class="col-md-1">Agenda</th>
<th class="col-md-1">Minutes</th>
@ -184,7 +185,7 @@
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<th class="col-md-1">Group</th>
<th class="col-md-1">Agenda</th>
<th class="col-md-1">Minutes</th>
@ -218,7 +219,7 @@
<table class="table table-condensed table-striped tablesorter">
<thead>
<tr>
{% if user|has_role:"Secretariat" or user|matman_groups %}
{% if user|has_role:"Secretariat" or user_groups %}
<th class="col-md-1">Group</th>
<th class="col-md-1">Agenda</th>
<th class="col-md-1">Minutes</th>
@ -277,6 +278,7 @@
</ul>
</div>
</div>
{% endwith %}
{% endblock %}
{% block js %}