Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Move shipping edit actions to dropdown menu
Anna Siwik75a7943c4b90
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.pyindex 250a630fbf..a713bf0964 100644--- a/saleor/dashboard/order/forms.py+++ b/saleor/dashboard/order/forms.py@@ -165,8 +165,6 @@ class OrderShippingForm(forms.ModelForm):method = self.instance.shipping_methodif method:method_field.set_initial(method, label=method.label)- else:- method_field.set_initial(None, obj_id='', label='----')if self.instance.shipping_address:country_code = self.instance.shipping_address.country.codediff --git a/saleor/dashboard/order/urls.py b/saleor/dashboard/order/urls.pyindex 1f23fd2864..8e7b48fcd9 100644--- a/saleor/dashboard/order/urls.py+++ b/saleor/dashboard/order/urls.py@@ -51,4 +51,4 @@ urlpatterns = [views.order_invoice, name='order-invoice'),url('^(?P<order_pk>\d+)/ajax/shipping-methods/$',- views.ajax_shipping_methods_list, name='ajax-order-shipping-methods')]+ views.ajax_order_shipping_methods_list, name='ajax-order-shipping-methods')]diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.pyindex 8875328346..aae508a917 100644--- a/saleor/dashboard/order/views.py+++ b/saleor/dashboard/order/views.py@@ -623,7 +623,7 @@ def change_fulfillment_tracking(request, order_pk, fulfillment_pk):@staff_member_required-def ajax_shipping_methods_list(request, order_pk):+def ajax_order_shipping_methods_list(request, order_pk):order = get_object_or_404(Order, pk=order_pk)queryset = ShippingMethodCountry.objects.select_related('shipping_method').order_by('price').all()@@ -638,8 +638,6 @@ def ajax_shipping_methods_list(request, order_pk):Q(shipping_method__name__icontains=search_query) |Q(price__icontains=search_query))- shipping_methods = [{'id': '', 'text': '----'}]- shipping_methods += [- {'id': method.pk, 'text': method.label}- for method in queryset]+ shipping_methods = [+ {'id': method.pk, 'text': method.label} for method in queryset]return JsonResponse({'results': shipping_methods})diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.htmlindex d5ecf7e08f..ad6a14c1d9 100644--- a/templates/dashboard/order/detail.html+++ b/templates/dashboard/order/detail.html@@ -296,7 +296,7 @@{{ line.unit_price.gross|amount:'html' }}</td><td class="right-align">- {% if order.is_draft %}+ {% if perms.order.edit_order and order.is_draft %}<a class="dropdown-button" href="#" data-activates="line-actions-{{ line.pk }}" data-constrainwidth="false">{{ line.quantity }} {% if line.stock_location and is_many_stock_locations %} ({{ line.stock_location|truncatechars:10 }}) {% endif %}<svg data-src="{% static "dashboard/images/arrow-drop-down.svg" %}" width="24" height="24" />@@ -333,17 +333,39 @@<td class="right-align" colspan="3"><p>{% trans "Subtotal" context "Order subtotal" %}</p><p>- {% if order.is_draft %}- <a href="#base-modal" data-href="{% url 'dashboard:order-shipping-edit' order_pk=order.pk %}"- class="modal-trigger-custom" title="{% trans "Edit shipping" context "Order totals action" %}">- {% trans "Shipping" context "Order totals header" %} ({{ order.shipping_method_name|default:"-" }})+ {% if perms.order.edit_order and order.is_draft %}+ <a class="dropdown-button" href="#" data-activates="shipping-actions" data-constrainwidth="false">+ {% if order.shipping_method_name %}+ {% blocktrans trimmed with shipping_name=order.shipping_method_name context "Order totals header" %}+ Shipping ({{ shipping_name }})+ {% endblocktrans %}+ {% else %}+ {% trans "Shipping" context "Order totals header" %}+ {% endif %}</a>+ <a class="dropdown-button" href="#" data-activates="shipping-actions" data-constrainwidth="false">+ <svg data-src="{% static "dashboard/images/arrow-drop-down.svg" %}" />+ </a>+ <ul id="shipping-actions" class="dropdown-content">+ <li>+ <a href="#base-modal" data-href="{% url 'dashboard:order-shipping-edit' order_pk=order.pk %}"+ class="modal-trigger-custom" title="{% trans "Edit shipping" context "Order totals action" %}">+ {% trans "Edit shipping" context "Order totals action" %}+ </a>+ </li>+ </ul>{% else %}- {% trans "Shipping" context "Order totals header" %} ({{ order.shipping_method_name|default:"-" }})+ {% if order.shipping_method_name %}+ {% blocktrans trimmed with shipping_name=order.shipping_method_name context "Order totals header" %}+ Shipping ({{ shipping_name }})+ {% endblocktrans %}+ {% else %}+ {% trans "Shipping" context "Order totals header" %}+ {% endif %}{% endif %}</p>- {% if order.is_draft or order.discount_amount %}- <p>+ <p>+ {% if perms.order.edit_order and order.is_draft %}<a class="dropdown-button" href="#" data-activates="voucher-actions" data-constrainwidth="false">{% if order.discount_name %}{% blocktrans trimmed with voucher=order.discount_name context "Order totals header" %}@@ -354,16 +376,24 @@{% endif %}<svg data-src="{% static "dashboard/images/arrow-drop-down.svg" %}" /></a>- </p>- <ul id="voucher-actions" class="dropdown-content">- <li>- <a href="#base-modal" data-href="{% url 'dashboard:order-remove-voucher' order_pk=order.pk %}"- class="modal-trigger-custom" title="{% trans "Remove voucher" context "Order totals action" %}">- {% trans "Remove voucher" context "Order totals action" %}- </a>- </li>- </ul>- {% endif %}+ <ul id="voucher-actions" class="dropdown-content">+ <li>+ <a href="#base-modal" data-href="{% url 'dashboard:order-remove-voucher' order_pk=order.pk %}"+ class="modal-trigger-custom" title="{% trans "Remove voucher" context "Order totals action" %}">+ {% trans "Remove voucher" context "Order totals action" %}+ </a>+ </li>+ </ul>+ {% elif order.discount_amount %}+ {% if order.discount_name %}+ {% blocktrans trimmed with voucher=order.discount_name context "Order totals header" %}+ Discount ({{ voucher }})+ {% endblocktrans %}+ {% else %}+ {% trans "Discount" context "Order totals header" %}+ {% endif %}+ {% endif %}+ </p><p><strong>{% trans "Grand total" context "Order totals header" %}</strong></p></td><td class="right-align">