Skip to content

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

Update templates and views

michalec916b43aed6
diff --git a/saleor/dashboard/group/views.py b/saleor/dashboard/group/views.py
index 16616aecff..7e372eb2a2 100644
--- a/saleor/dashboard/group/views.py
+++ b/saleor/dashboard/group/views.py
@@ -43,6 +43,7 @@ def group_details(request, pk):
request,
pgettext_lazy('Dashboard message', 'Updated group %s') % group.name
)
+ return redirect('dashboard:group-list')
ctx = {'group': group, 'form': form}
return TemplateResponse(request, 'dashboard/group/detail.html', ctx)
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
index 71445a72b5..85f5c3ad02 100644
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -79,7 +79,7 @@ def order_details(request, order_pk):
@staff_member_required
-@permission_required('order.view_order')
+@permission_required('order.edit_order')
def order_add_note(request, order_pk):
order = get_object_or_404(Order, pk=order_pk)
note = OrderNote(order=order, user=request.user)
@@ -347,6 +347,8 @@ def cancel_order(request, order_pk):
ctx, status=status)
+@staff_member_required
+@permission_required('order.edit_order')
def remove_order_voucher(request, order_pk):
status = 200
order = get_object_or_404(Order, pk=order_pk)
diff --git a/templates/dashboard/group/detail.html b/templates/dashboard/group/detail.html
index 06606207de..f18264a2fa 100644
--- a/templates/dashboard/group/detail.html
+++ b/templates/dashboard/group/detail.html
@@ -72,11 +72,11 @@
</h5>
</div>
<div class="card-content">
- <div class="data">
- {% csrf_token %}
- <div class="row">
+ {% csrf_token %}
+ <div class="row">
+ <div class="col s12">
{{ form|materializecss }}
- </div>
+ </div>
</div>
</div>
<div class="card-action right-align">
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index b4edcad893..f850d3a962 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -445,11 +445,13 @@
</p>
{% endif %}
</div>
- <div class="card-action">
- <a data-href="{% url "dashboard:order-add-note" order_pk=order.pk %}" class="modal-trigger-custom btn btn-flat" href="#base-modal">
- {% trans "Add note" context "Order notes card action" %}
- </a>
- </div>
+ {% if perms.order.edit_order %}
+ <div class="card-action">
+ <a data-href="{% url "dashboard:order-add-note" order_pk=order.pk %}" class="modal-trigger-custom btn btn-flat" href="#base-modal">
+ {% trans "Add note" context "Order notes card action" %}
+ </a>
+ </div>
+ {% endif %}
</div>
</div>
</div>
diff --git a/templates/dashboard/staff/detail.html b/templates/dashboard/staff/detail.html
index f3df2d229d..5e58990072 100644
--- a/templates/dashboard/staff/detail.html
+++ b/templates/dashboard/staff/detail.html
@@ -57,101 +57,6 @@
</div>
</form>
{% endif %}
- <div class="card">
- <div class="data-table-header{% if not customer_orders %} data-table-header--no-data{% endif %}">
- <h5 class="data-table-title">
- {% trans "Order history" context "Customer orders table title" %}
- </h5>
- </div>
- {% if customer_orders %}
- <div class="data-table-container">
- <table class="bordered highlight responsive data-table">
- <thead>
- <tr>
- <th>
- {% trans "Number" context "Customer orders table header" %}
- </th>
- <th>
- {% trans "Placed on" context "Customer orders table header" %}
- </th>
- <th>
- {% trans "Order status" context "Customer orders table header" %}
- </th>
- <th class="right-align">
- {% trans "Total" context "Customer orders table header" %}
- </th>
- </tr>
- </thead>
- <tbody>
- {% for order in customer_orders %}
- <tr data-action-go="{% url 'dashboard:order-details' order_pk=order.pk %}">
- <td>
- {{ order }}
- </td>
- <td>
- {{ order.created }}
- </td>
- <td>
- {% render_status order.status order.get_status_display %}
- </td>
- <td class="right-align">
- {% gross order.get_total html=True %}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- {% else %}
- <div class="card-content card-content--no-data">
- <p>
- {% trans "No orders found." context "Empty customer orders table message" %}
- </p>
- </div>
- {% endif %}
- </div>
- </div>
- <div class="col s12 l4">
- <div class="row">
- <div class="col s12 m6 p6 l12">
- <div class="card equal-height-on-med">
- <div class="card-content">
- <span class="card-title black-text">
- {% trans "Default shipping address" context "Customer default shipping address card title" %}
- </span>
- {% if staff_member.default_shipping_address %}
- {% with staff_member.default_shipping_address as address %}
- {% include 'dashboard/includes/_address.html' with address=address only %}
- {% endwith %}
- {% else %}
- <div>{% trans "No default shipping address." context "Customer without default shipping address message" %}</div>
- {% endif %}
- <svg data-src="{% static "dashboard/images/email.svg" %}" width="14" height="14" />
- <a href="mailto:{{ staff_member.email }}">
- {{ staff_member.email }}
- </a>
- </div>
- </div>
- </div>
- <div class="col s12 m6 p6 l12">
- <div class="card equal-height-on-med">
- <div class="card-content">
- <span class="card-title black-text">
- {% trans "Default billing address" context "Customer default billing address card title" %}
- </span>
- {% if staff_member.default_billing_address %}
- {% with staff_member.default_billing_address as address %}
- {% include 'dashboard/includes/_address.html' with address=address only %}
- {% endwith %}
- {% else %}
- <div>
- {% trans "No default billing address." context "Customer without default billing address message" %}
- </div>
- {% endif %}
- </div>
- </div>
- </div>
</div>
</div>
- </div>
{% endblock %}