Check permissions in edit part form.

This commit is contained in:
Jan Böhmer 2019-03-19 19:00:39 +01:00
parent 6ed2eeabae
commit 8d36bf913d
3 changed files with 62 additions and 22 deletions

View file

@ -23,7 +23,12 @@
</div>
<div class="col-md-9">
<h5 class="text-muted pt-2" title="{% trans %}manufacturer.label{% endtrans %}">{{ part.manufacturer.name ?? ""}}</h5>
<h3>{{ part.name }} <a href="{{ part|entityURL('edit') }}"><i class="fas fa-fw fa-sm fa-edit"></i></a></h3>
<h3>{{ part.name }}
{# You need edit permission to use the edit button #}
{% if is_granted('edit', part) %}
<a href="{{ part|entityURL('edit') }}"><i class="fas fa-fw fa-sm fa-edit"></i></a>
{% endif %}
</h3>
<h6 class="text-muted"><span title="{% trans %}description.label{% endtrans %}">{{ part.description|bbCode }}</span></h6>
<h6 class="" title="{% trans %}category.label{% endtrans %}">
<i class="fas fa-tag fa-fw"></i>
@ -63,13 +68,13 @@
<div class="mt-3">
<ul class="nav nav-tabs" id="partTab" role="tablist">
{% if part.comment is not empty %}
<li class="nav-item">
<a class="nav-link active" id="attachment-tab" data-toggle="tab"
href="#comment" role="tab" aria-controls="home" aria-selected="true">
<i class="fas fa-comment-alt fa-fw"></i>
{% trans %}comment.label{% endtrans %}
</a>
</li>
<li class="nav-item">
<a class="nav-link active" id="attachment-tab" data-toggle="tab"
href="#comment" role="tab" aria-controls="home" aria-selected="true">
<i class="fas fa-comment-alt fa-fw"></i>
{% trans %}comment.label{% endtrans %}
</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link {% if part.comment is empty%} active{% endif %}" id="attachment-tab" data-toggle="tab"
@ -99,11 +104,11 @@
</ul>
<div class="tab-content" id="myTabContent">
{% if part.comment is not empty %}
<div class="tab-pane fade show active" id="comment" role="tabpanel" aria-labelledby="home-tab">
<div class="container-fluid mt-2">
{{ part.comment|bbCode }}
<div class="tab-pane fade show active" id="comment" role="tabpanel" aria-labelledby="home-tab">
<div class="container-fluid mt-2">
{{ part.comment|bbCode }}
</div>
</div>
</div>
{% endif %}
<div class="tab-pane fade {% if part.comment is empty %} show active{% endif %}" id="attachments" role="tabpanel" aria-labelledby="profile-tab">
Test