Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use JS to spawn and hide toasts
Patryk Zawadzki0cd7ef97c4f1
diff --git a/saleor/dashboard/templates/dashboard/base.html b/saleor/dashboard/templates/dashboard/base.htmlindex 5a8b7299f1..b63936862d 100644--- a/saleor/dashboard/templates/dashboard/base.html+++ b/saleor/dashboard/templates/dashboard/base.html@@ -103,8 +103,6 @@<main class="main"><div class="container">- {% include "dashboard/includes/_messages.html" %}-{% block content %}{% endblock %}</div>@@ -118,6 +116,7 @@<!-- Core Scripts - Include with every page --><script src="{% static "js/dashboard.js" %}"></script><script src="{% static "versatileimagefield/js/versatileimagefield.js" %}"></script>+ {% include "dashboard/includes/_messages.html" %}{% block custom_js %}{% endblock %}</body>diff --git a/saleor/dashboard/templates/dashboard/includes/_messages.html b/saleor/dashboard/templates/dashboard/includes/_messages.htmlindex 017cde3a76..8343bf8ee1 100644--- a/saleor/dashboard/templates/dashboard/includes/_messages.html+++ b/saleor/dashboard/templates/dashboard/includes/_messages.html@@ -1,25 +1,23 @@-{% load i18n %}-{% if messages %}+<script>{% for message in messages %}- <div class="toast toast--fixed toast--hidden message">- {% if 'safe' in message.tags %}- {{ message|safe }}- {% else %}- {{ message }}- {% endif %}- </div>+ {% if 'safe' in message.tags %}+ Materialize.toast('{{ message|safe|escapejs }}', 5000);+ {% else %}+ Materialize.toast('{{ message|escapejs }}', 5000);+ {% endif %}{% endfor %}+</script>{% endif %}{% if form.non_field_errors %}+<script>{% for message in form.non_field_errors %}- <div class="toast toast--fixed toast--hidden message">- {% if 'safe' in message.tags %}- {{ message|safe }}- {% else %}- {{ message }}- {% endif %}- </div>+ {% if 'safe' in message.tags %}+ Materialize.toast('{{ message|safe|escapejs }}', 5000);+ {% else %}+ Materialize.toast('{{ message|escapejs }}', 5000);+ {% endif %}{% endfor %}+</script>{% endif %}diff --git a/webpack.config.js b/webpack.config.jsindex 68f270c0e3..901859153f 100644--- a/webpack.config.js+++ b/webpack.config.js@@ -22,13 +22,12 @@ configuration = {plugins: [new webpack.ProvidePlugin({$: 'jquery',- jQuery: 'jquery',- 'window.jQuery': 'jquery'- }),- new webpack.ProvidePlugin({'_': 'underscore',+ jQuery: 'jquery',+ 'window.jQuery': 'jquery',Backbone: 'backbone',- 'window.Backbone': 'backbone'+ 'window.Backbone': 'backbone',+ Hammer: 'hammerjs'}),new webpack.optimize.UglifyJsPlugin(),new webpack.optimize.DedupePlugin()