Add direct admin links if the user is staff

This commit is contained in:
Oliver Walters 2020-09-30 00:02:10 +10:00
parent 0e5f10c020
commit d1cce7df94
6 changed files with 32 additions and 6 deletions

View File

@ -33,7 +33,12 @@ src="{% static 'img/blank_image.png' %}"
{% block page_data %}
<h3>{% trans "Build" %} {% build_status_label build.status large=True %}</h3>
<hr>
<h4>{{ build.quantity }} x {{ build.part.full_name }}</h4>
<h4>
{{ build.quantity }} x {{ build.part.full_name }}
{% if user.is_staff %}
<a href="{% url 'admin:build_build_change' build.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>
<div class='btn-row'>
<div class='btn-group action-buttons'>
<button type='button' class='btn btn-default' id='build-edit' title='Edit Build'>

View File

@ -21,7 +21,12 @@ InvenTree | {% trans "Company" %} - {{ company.name }}
{% block page_data %}
<h3>{% trans "Company" %}</h3>
<hr>
<h4>{{ company.name }}</h4>
<h4>
{{ company.name }}
{% if user.is_staff %}
<a href="{% url 'admin:company_company_change' company.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>
<p>{{ company.description }}</p>
<div class='btn-group action-buttons'>
{% if company.is_supplier %}

View File

@ -7,7 +7,12 @@
<div class='row'>
<div class='col-sm-6'>
{% if category %}
<h3>{{ category.name }}</h3>
<h3>
{{ category.name }}
{% if user.is_staff %}
<a href="{% url 'admin:part_partcategory_change' category.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ category.description }}</p>
{% else %}
<h3>{% trans "Part Categories" %}</h3>

View File

@ -28,6 +28,9 @@
<div class="media-body">
<h3>
{{ part.full_name }}
{% if user.is_staff %}
<a href="{% url 'admin:part_part_change' part.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
{% if not part.active %}
<div class='label label-large label-large-red'>
{% trans 'Inactive' %}

View File

@ -61,9 +61,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
<hr>
<h4>
{% if item.serialized %}
<a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name}}</a> # {{ item.serial }}
<a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name}}</a> # {{ item.serial }}
{% else %}
<a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name }}</a> &times {% decimal item.quantity %}
<a href='{% url "part-detail" item.part.pk %}'>{{ item.part.full_name }}</a> &times {% decimal item.quantity %}
{% endif %}
{% if user.is_staff %}
<a href="{% url 'admin:stock_stockitem_change' item.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h4>

View File

@ -6,7 +6,12 @@
<div class='row'>
<div class='col-sm-6'>
{% if location %}
<h3>{{ location.name }}</h3>
<h3>
{{ location.name }}
{% if user.is_staff %}
<a href="{% url 'admin:stock_stocklocation_change' location.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ location.description }}</p>
{% else %}
<h3>{% trans "Stock" %}</h3>