Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Rename model_delete.html to match whole project convention
akjanikeb97daf43e62
diff --git a/saleor/dashboard/collection/views.py b/saleor/dashboard/collection/views.pyindex 657a26a64f..9e85fec46a 100644--- a/saleor/dashboard/collection/views.py+++ b/saleor/dashboard/collection/views.py@@ -18,15 +18,15 @@ def collection_list(request):collections = Collection.objects.prefetch_related('products').all()collections = get_paginator_items(collections, 30, request.GET.get('page'))ctx = {'collections': collections}- return TemplateResponse(request,- 'dashboard/collection/list.html', ctx)+ return TemplateResponse(+ request, 'dashboard/collection/list.html', ctx)@staff_member_required@permission_required('product.edit_product')def collection_create(request):collection = Collection()- form = CollectionForm(request.POST or None)+ form = CollectionForm(request.POST or None, instance=collection)if form.is_valid():collection = form.save()msg = pgettext_lazy('Collection message', 'Added collection')@@ -63,5 +63,5 @@ def collection_delete(request, pk=None):return JsonResponse(response)return redirect('dashboard:collection-list')ctx = {'collection': collection}- return TemplateResponse(request, 'dashboard/collection/modal_delete.html',- ctx)+ return TemplateResponse(+ request, 'dashboard/collection/confirm_delete.html', ctx)diff --git a/saleor/product/views.py b/saleor/product/views.pyindex 9e31d35556..80587a7db7 100644--- a/saleor/product/views.py+++ b/saleor/product/views.py@@ -1,6 +1,5 @@import datetimeimport json-from random import randintfrom django.conf import settingsfrom django.http import HttpResponsePermanentRedirect, JsonResponse@@ -12,7 +11,7 @@ from ..cart.utils import set_cart_cookiefrom ..core.utils import get_paginator_items, serialize_decimalfrom ..core.utils.filters import get_now_sorted_byfrom .filters import ProductFilter, SORT_BY_FIELDS-from .models import Category, Product+from .models import Categoryfrom .utils import (get_availability, get_product_attributes_data, get_product_images,get_variant_picker_data, handle_cart_form, product_json_ld,diff --git a/saleor/static/js/storefront.js b/saleor/static/js/storefront.jsindex 8d2f4cd8cc..6813ee14e3 100644--- a/saleor/static/js/storefront.js+++ b/saleor/static/js/storefront.js@@ -11,6 +11,3 @@ import './components/address-form';import './components/password-input';import './components/styleguide';import './components/misc';--let $collections = $('#collections');-$collections.load($collections.data('url'));diff --git a/templates/dashboard/collection/confirm_delete.html b/templates/dashboard/collection/confirm_delete.htmlnew file mode 100644index 0000000000..d9fc21658e--- /dev/null+++ b/templates/dashboard/collection/confirm_delete.html@@ -0,0 +1,27 @@+{% extends "dashboard/base_modal.html" %}++{% load i18n %}++{% block form_class %}{% endblock %}++{% block action_url %}+{% url 'dashboard:collection-delete' pk=collection.pk %}+{% endblock %}++{% block title %}+{% blocktrans trimmed context "Modal remove collection text" %}+ Remove collection {{ collection }}+{% endblocktrans %}+{% endblock %}++{% block content %}+ <div class="col s12">+ {% blocktrans trimmed context "Modal remove collection text" %}+ Are you sure you want to remove collection <strong>{{ collection }}</strong>?+ {% endblocktrans %}+ </div>+{% endblock content %}++{% block primary_action %}+{% trans "Remove" context "Dashboard delete action" %}+{% endblock %}diff --git a/templates/dashboard/collection/detail.html b/templates/dashboard/collection/detail.htmlindex adefc369ee..f23382ff91 100644--- a/templates/dashboard/collection/detail.html+++ b/templates/dashboard/collection/detail.html@@ -1,6 +1,7 @@{% extends 'dashboard/base.html' %}{% load materializecss %}{% load i18n %}+{% load staticfiles %}{% block title %}{% if collection.pk %}{{ collection }}{% else %}{% trans 'Add new collection' %}{% endif %} - {% trans 'Collections' %} - {{ block.super }}{% endblock %}@@ -19,18 +20,35 @@</ul>{% endblock %}+{#{% block header_extra %}#}+{# {% if collection.pk %}#}+{# <a class="dropdown-button right" href="#" data-activates="collection-delete" data-constrainwidth="false">#}+{# <i class="material-icons">more_vert</i>#}+{# </a>#}+{# <ul id="collection-delete" class="dropdown-content">#}+{# <li>#}+{# <a class="modal-trigger-custom" data-href="{% url 'dashboard:collection-delete' collection.pk %}" href="#base-modal">#}+{# {% trans "Remove collection" context "Collection detail action" %}#}+{# </a>#}+{# </li>#}+{# </ul>#}+{# {% endif %}#}+{#{% endblock %}#}+{% block header_extra %}{% if collection.pk %}- <a class="dropdown-button right" href="#" data-activates="collection-delete" data-constrainwidth="false">- <i class="material-icons">more_vert</i>- </a>- <ul id="collection-delete" class="dropdown-content">- <li>- <a class="modal-trigger-custom" data-href="{% url 'dashboard:collection-delete' collection.pk %}" href="#base-modal">- {% trans "Remove collection" context "Collection detail action" %}- </a>- </li>- </ul>+ {% if perms.product.edit_product %}+ <a class="dropdown-button right" href="#" data-activates="collection-delete" data-constrainwidth="false">+ <svg data-src="{% static "dashboard/images/more-vert.svg" %}" height="24" width="24" />+ </a>+ <ul id="collection-delete" class="dropdown-content">+ <li>+ <a class="modal-trigger-custom" href="#base-modal" data-href="{% url 'dashboard:collection-delete' pk=collection.pk %}">+ {% trans "Remove collection" context "Collection action" %}+ </a>+ </li>+ </ul>+ {% endif %}{% endif %}{% endblock %}diff --git a/templates/dashboard/collection/list.html b/templates/dashboard/collection/list.htmlindex f00937ee90..bedcd2d94e 100644--- a/templates/dashboard/collection/list.html+++ b/templates/dashboard/collection/list.html@@ -62,8 +62,6 @@</tbody></div></div>- {% else %}- <p>{% trans "No collections" %}</p>{% endif %}</div></div>diff --git a/templates/dashboard/collection/modal_delete.html b/templates/dashboard/collection/modal_delete.htmldeleted file mode 100644index 186352052c..0000000000--- a/templates/dashboard/collection/modal_delete.html+++ /dev/null@@ -1,22 +0,0 @@-{% load i18n %}--<form method="post" id="form-category" class="form-async" action="{% url 'dashboard:collection-delete' collection.pk %}" novalidate>- {% csrf_token %}- <div class="modal-content">- <div class="row">- <div class="col s12">- <h5>- {% blocktrans with collection=collection %}- Are you sure you want to delete the collection {{ collection }}?- {% endblocktrans %}- </h5>- </div>- </div>-- </div>-- <div class="modal-footer">- <button type="submit" class="modal-action btn-flat blue-text">{% trans "Delete" %}</button>- <a href="#!" class="modal-action modal-close btn-flat blue-text">{% trans "Cancel" %}</a>- </div>-</form>