Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Hide buttons behind permission check

michal9f721638bfa6
diff --git a/templates/dashboard/category/detail.html b/templates/dashboard/category/detail.html
index 5846904e84..f80e25ba0b 100644
--- a/templates/dashboard/category/detail.html
+++ b/templates/dashboard/category/detail.html
@@ -83,7 +83,7 @@
{% if root.description %}
<div class="col s12 m4 l12">
<h4>
- {% trans "Description" context "Shipping method field" %}
+ {% trans "Description" context "Category field" %}
</h4>
<p>
{{ root.description }}
@@ -143,16 +143,18 @@
&nbsp;
{% endif %}
</td>
- <td class="right-align">
- <a href="{% url 'dashboard:category-edit' root_pk=node.pk %}" class="btn btn-flat">
- {% trans 'Edit' context 'Category edit action' %}
- </a>
- <a class="btn btn-flat modal-trigger-custom"
- data-href="{% url 'dashboard:category-delete' pk=node.pk %}"
- href="#base-modal">
- {% trans "Remove" context "Category list action link" %}
- </a>
- </td>
+ {% if perms.product.edit_category %}
+ <td class="right-align">
+ <a href="{% url 'dashboard:category-edit' root_pk=node.pk %}" class="btn btn-flat">
+ {% trans 'Edit' context 'Category edit action' %}
+ </a>
+ <a class="btn btn-flat modal-trigger-custom"
+ data-href="{% url 'dashboard:category-delete' pk=node.pk %}"
+ href="#base-modal">
+ {% trans "Remove" context "Category list action link" %}
+ </a>
+ </td>
+ {% endif %}
</tr>
{% empty %}
<tr>
diff --git a/templates/dashboard/shipping/detail.html b/templates/dashboard/shipping/detail.html
index b4836a4337..ae0244a3a1 100644
--- a/templates/dashboard/shipping/detail.html
+++ b/templates/dashboard/shipping/detail.html
@@ -17,7 +17,7 @@
{% block breadcrumbs %}
<ul class="breadcrumbs breadcrumbs--history">
<li>
- <a href="{% url "dashboard:shipping-methods" %}">
+ <a href="{% url 'dashboard:shipping-methods' %}">
{% trans "Shipping methods" context "Shipping method form breadcrumbs" %}
</a>
</li>
@@ -55,10 +55,10 @@
</div>
{% if perms.shipping.edit_shipping %}
<div class="card-action">
- <a class="btn btn-flat" href="{% url "dashboard:shipping-method-update" shipping_method.pk %}">
+ <a class="btn btn-flat" href="{% url 'dashboard:shipping-method-update' shipping_method.pk %}">
{% trans "Edit shipping method" context "Shipping method action" %}
</a>
- <a class="btn btn-flat modal-trigger-custom" href="#base-modal" data-href="{% url "dashboard:shipping-method-delete" shipping_method.pk %}">
+ <a class="btn btn-flat modal-trigger-custom" href="#base-modal" data-href="{% url 'dashboard:shipping-method-delete' shipping_method.pk %}">
{% trans "Remove shipping method" context "Shipping method action" %}
</a>
</div>