Skip to content

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

Improve product form

Paweł Kowalewski41d529db6fc8
diff --git a/Gruntfile.js b/Gruntfile.js
index 56c20f795d..07baad4dae 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -4,9 +4,9 @@ module.exports = function(grunt) {
dev: {
bsFiles: {
src: [
- 'saleor/static/css/*.css',
- 'saleor/static/js/*.js',
- 'saleor/**/*.html'
+ "saleor/static/css/*.css",
+ "saleor/static/js/*.js",
+ "saleor/**/*.html"
]
},
options: {
@@ -18,6 +18,16 @@ module.exports = function(grunt) {
}
}
},
+ concat: {
+ dist: {
+ src: [
+ "saleor/static/css/dashboard.css",
+ "saleor/static/components/dropzone/dist/basic.css",
+ "saleor/static/components/dropzone/dist/dropzone.css"
+ ],
+ dest: "saleor/static/css/dashboard.css"
+ }
+ },
copy: {
production: {
files: [
@@ -114,8 +124,8 @@ module.exports = function(grunt) {
options: {
map: true,
processors: [
- require('autoprefixer-core'),
- require('csswring')
+ require("autoprefixer-core"),
+ require("csswring")
]
},
prod: {
@@ -141,6 +151,7 @@ module.exports = function(grunt) {
dev: {
files: {
"saleor/static/js/dashboard.js": [
+ "saleor/static/components/dropzone/dist/dropzone.js",
"saleor/static/components/jquery/dist/jquery.js",
"saleor/static/components/materialize/dist/js/materialize.js",
"saleor/static/components/Sortable/Sortable.js",
@@ -168,15 +179,9 @@ module.exports = function(grunt) {
}
});
- grunt.loadNpmTasks("grunt-browser-sync");
- grunt.loadNpmTasks("grunt-contrib-copy");
- grunt.loadNpmTasks("grunt-contrib-less");
- grunt.loadNpmTasks("grunt-contrib-uglify");
- grunt.loadNpmTasks("grunt-contrib-watch");
- grunt.loadNpmTasks("grunt-postcss");
- grunt.loadNpmTasks("grunt-sass");
+ require("load-grunt-tasks")(grunt);
- grunt.registerTask("default", ["copy", "less", "sass", "postcss", "uglify"]);
+ grunt.registerTask("default", ["copy", "less", "sass", "concat", "postcss", "uglify"]);
grunt.registerTask("sync", ["browserSync", "watch"]);
- grunt.registerTask("heroku", ["copy", "less", "sass", "postcss", "uglify"]);
+ grunt.registerTask("heroku", ["copy", "less", "sass", "concat", "postcss", "uglify"]);
};
diff --git a/bower.json b/bower.json
index c8a315351e..7fb318a208 100644
--- a/bower.json
+++ b/bower.json
@@ -14,6 +14,7 @@
"materialize": "~0.97.0",
"jquery": "~2.1.4",
"Sortable": "[email protected]:RubaXa/Sortable.git#~1.2.0",
- "select2": "~4.0.0"
+ "select2": "~4.0.0",
+ "dropzone": "~4.0.1"
}
}
diff --git a/package.json b/package.json
index 49005f4b81..e0d64493f3 100644
--- a/package.json
+++ b/package.json
@@ -27,6 +27,8 @@
"grunt-browser-sync": "~2.1.3",
"grunt-postcss": "~0.4.0",
"autoprefixer-core": "~5.2.0",
- "csswring": "~3.0.5"
+ "csswring": "~3.0.5",
+ "grunt-contrib-concat": "~0.5.1",
+ "load-grunt-tasks": "~3.2.0"
}
}
diff --git a/saleor/static/js_src/dashboard.js b/saleor/static/js_src/dashboard.js
index ba82c2326e..9c716c5b3f 100644
--- a/saleor/static/js_src/dashboard.js
+++ b/saleor/static/js_src/dashboard.js
@@ -14,6 +14,7 @@ $(document).ready(function() {
var el = document.getElementById('product-gallery');
if (el) {
var sortable = Sortable.create(el, {
+ handle: '.card-image',
onUpdate: function () {
$.ajax({
dataType: 'json',
diff --git a/saleor/static/scss/widget/_product-gallery.scss b/saleor/static/scss/widget/_product-gallery.scss
index 1eb1278632..3287725fa2 100644
--- a/saleor/static/scss/widget/_product-gallery.scss
+++ b/saleor/static/scss/widget/_product-gallery.scss
@@ -1,21 +1,32 @@
@mixin product-gallery {
& &-item {
- cursor: move;
margin: 0 $gutter-width/2 $gutter-width !important;
padding: 0;
display: block;
position: relative;
- text-align: center;
- width: calc(50% - 1.5rem) !important;
+ width: calc(50% - #{$gutter-width*3/2}) !important;
+
+ @media (min-width: $small-screen-up) {
+ width: calc(33.3% - #{$gutter-width}) !important;
+ }
@media (min-width: $medium-screen-up) {
- width: calc(25% - 1.5rem) !important;
+ width: calc(20% - #{$gutter-width}) !important;
+ }
+
+ &-reorder {
+ position: absolute;
+ }
+
+ &-image {
+ cursor: move;
+ }
- &:hover {
- .product-gallery-item-create, .product-gallery-item-remove {
- display: block;
- }
- }
+ &-title, &-desc {
+ display: block;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
&-text {
@@ -33,25 +44,6 @@
text-overflow: ellipsis;
white-space: nowrap;
}
-
- &-create, &-remove {
- bottom: 0;
- font-size: $font-size-action-icon;
- line-height: 48px;
- position: absolute;
- right: 0;
- width: 48px;
-
- @media (min-width: $medium-screen-up) {
- display: none;
- }
- }
-
- &-remove {
- bottom: auto;
- text-shadow: 0 0 1px white;
- top: 0;
- }
}
.sortable-ghost {