Skip to content

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

Improve orders styles and scripts

Paweł Kowalewski3c7529144baa
diff --git a/saleor/static/js_src/dashboard.js b/saleor/static/js_src/dashboard.js
index ce7e21280d..52a1cfa92d 100644
--- a/saleor/static/js_src/dashboard.js
+++ b/saleor/static/js_src/dashboard.js
@@ -1,9 +1,7 @@
$('.button-collapse').sideNav();
-$('select:not(.browser-default):not([multiple])').material_select();
-$('select[multiple]').addClass('browser-default').select2();
-$('.modal-trigger').leanModal();
$(document).ready(function() {
var $tabs = $('ul.tabs');
+ initSelects();
if ($tabs.length) {
$tabs.find('.tab').on('click', function (e) {
@@ -23,20 +21,44 @@ $(document).ready(function() {
$breadcrumbsItems.css('max-width', breadcrumbsItemWidth).dotdotdot({'height': 50});
}
- var $orderModal = $('#base-modal');
- if ($orderModal) {
- $('.modal-trigger-custom').on('click', function (e) {
- $.ajax({
- url: $(this).data('href'),
- method: 'get',
- success: function (response) {
- $orderModal.html(response).openModal();
- }
- });
+ $('.modal-trigger-custom').on('click', function (e) {
+ var that = this;
+ $.ajax({
+ url: $(this).data('href'),
+ method: 'get',
+ success: function (response) {
+ var $modal = $($(that).attr('href'));
+ $modal.html(response);
+ initSelects();
+ $modal.openModal();
+ }
+ });
+
+ e.preventDefault();
+ });
- e.preventDefault();
+ $(document).on('submit', '.form-async', function(e) {
+ var that = this;
+ $.ajax({
+ url: $(that).attr('action'),
+ method: 'post',
+ data: $(that).serialize(),
+ complete: function(response) {
+ if (response.status === 400) {
+ $(that).parent().html(response.responseText);
+ initSelects();
+ } else {
+ $('.modal-close').click();
+ }
+ },
+ success: function(response) {
+ location.reload();
+ }
});
- }
+ e.preventDefault();
+ }).on('click', '.modal-close', function() {
+ $('.modal').closeModal();
+ });
});
Dropzone.options.productImageForm = {
paramName: "image",
@@ -120,3 +142,7 @@ $('.datepicker').pickadate({
selectYears: 15,
selectMonths: true
});
+function initSelects() {
+ $('select:not(.browser-default):not([multiple])').material_select();
+ $('select[multiple]').addClass('browser-default').select2();
+}
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index 91afd6f527..fbdb5b088b 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -287,6 +287,20 @@ table {
margin: 0;
}
+.switch-two-columns {
+ @media (min-width: $large-screen) {
+ float: left !important;
+
+ &:first-child {
+ float: right !important;
+ }
+ }
+}
+
+.text-lg {
+ font-size: 120%;
+}
+
@import "widget/breadcrumbs";
@import "widget/card";
@import "widget/data-table";
diff --git a/saleor/static/scss/widget/_data-table.scss b/saleor/static/scss/widget/_data-table.scss
index da9473a443..fd1cbee279 100644
--- a/saleor/static/scss/widget/_data-table.scss
+++ b/saleor/static/scss/widget/_data-table.scss
@@ -55,6 +55,10 @@
&:last-child {
padding-right: 24px;
}
+
+ &.no-padded {
+ padding: 0;
+ }
}
th {
@@ -91,6 +95,17 @@
border-top: none;
}
}
+
+ .dropdown-button {
+ padding: 15px 28px;
+ }
+
+ .dropdown-content {
+ left: auto !important;
+ right: 0;
+ top: 0;
+ white-space: nowrap;
+ }
}
.data-table {
diff --git a/saleor/static/scss/widget/_form.scss b/saleor/static/scss/widget/_form.scss
index 4159f55dfa..35b18ed725 100644
--- a/saleor/static/scss/widget/_form.scss
+++ b/saleor/static/scss/widget/_form.scss
@@ -102,6 +102,11 @@
display: none;
}
}
+
+ .btn--inline {
+ display: inline-block;
+ margin-top: 1.4rem;
+ }
}
form {