Skip to content

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

Fix image grid

dominik-zeglen04ae55059dd7
diff --git a/saleor/static/dashboard/scss/components/_product-gallery.scss b/saleor/static/dashboard/scss/components/_product-gallery.scss
index 469a6c450b..ce523f489a 100644
--- a/saleor/static/dashboard/scss/components/_product-gallery.scss
+++ b/saleor/static/dashboard/scss/components/_product-gallery.scss
@@ -1,18 +1,22 @@
@mixin product-gallery {
margin: 0;
&-item {
- margin: 0 $gutter-width/2 $gutter-width !important;
+ margin-left: $gutter-width * .66 !important;
padding: 0;
display: block;
position: relative;
- width: calc(50% - #{$gutter-width*3/2}) !important;
+ width: calc(100% - #{$gutter-width*3/2}) !important;
@media (min-width: $small-screen-up) {
- width: calc(33.3% - #{$gutter-width}) !important;
+ width: calc(50% - #{$gutter-width * 0.9}) !important;
}
@media (min-width: $medium-screen-up) {
- width: calc(20% - #{$gutter-width}) !important;
+ width: calc(33.3% - #{$gutter-width * 0.9}) !important;
+ }
+
+ @media (min-width: $large-screen-up) {
+ width: calc(25% - #{$gutter-width * 0.8}) !important;
}
&-reorder {
diff --git a/templates/dashboard/product/product_image/list.html b/templates/dashboard/product/product_image/list.html
index 9929a3ee6d..5925fae90d 100644
--- a/templates/dashboard/product/product_image/list.html
+++ b/templates/dashboard/product/product_image/list.html
@@ -46,92 +46,94 @@
{% block menu_catalogue_class %} active{% endblock %}
{% block content %}
- <div id="images" class="tab-content">
- <form action="{% url 'dashboard:product-images-upload' product_pk=product.pk %}" class="" id="product-image-form" novalidate>
- <div class="dz-message"></div>
- {% csrf_token %}
- <div class="row">
- <ul class="product-gallery" id="product-gallery" data-post-url="{% url 'dashboard:product-images-reorder' product_pk=product.pk %}">
- {% if images %}
- {% for image in images %}
- <li class="col s6 m3 product-gallery-item" data-id="{{ image.pk }}">
- <div class="row">
- <div class="card">
- <div class="card-image product-gallery-item-image">
- <img class="responsive-img"
- src="{{ image.image.crop.255x255 }}"
- srcset="{{ image.image.crop.255x255 }} 1x, {{ image.image.crop.510x510 }} 2x"
- alt="">
- </div>
- <div class="card-content">
- <span class="product-gallery-item-title card-title black-text" title="{{ image.alt }}">
- {% if image.alt %}
- {{ image.alt }}
- {% else %}
- <span class="grey-text">
- {% trans "No description" context "Image card text" %}
- </span>
- {% endif %}
- </span>
- </div>
- <div class="sortable__drag-area"></div>
- <div class="card-action">
- <a class="btn-flat waves-effect" href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=image.pk %}">
- {% trans "Edit" context "Dashboard edit action" %}
- </a>
- <a href="#base-modal" class="btn-flat waves-effect modal-trigger-custom" data-href="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=image.pk %}">
- {% trans "Remove" context "Dashboard remove action" %}
- </a>
+ <div class="row">
+ <div id="images" class="tab-content col s12 m9">
+ <form action="{% url 'dashboard:product-images-upload' product_pk=product.pk %}" class="" id="product-image-form" novalidate>
+ <div class="dz-message"></div>
+ {% csrf_token %}
+ <div class="row">
+ <ul class="product-gallery" id="product-gallery" data-post-url="{% url 'dashboard:product-images-reorder' product_pk=product.pk %}">
+ {% if images %}
+ {% for image in images %}
+ <li class="col s12 m3 product-gallery-item" data-id="{{ image.pk }}">
+ <div class="row">
+ <div class="card">
+ <div class="card-image product-gallery-item-image">
+ <img class="responsive-img"
+ src="{{ image.image.crop.255x255 }}"
+ srcset="{{ image.image.crop.255x255 }} 1x, {{ image.image.crop.510x510 }} 2x"
+ alt="">
+ </div>
+ <div class="card-content">
+ <span class="product-gallery-item-title card-title black-text" title="{{ image.alt }}">
+ {% if image.alt %}
+ {{ image.alt }}
+ {% else %}
+ <span class="grey-text">
+ {% trans "No description" context "Image card text" %}
+ </span>
+ {% endif %}
+ </span>
+ </div>
+ <div class="sortable__drag-area"></div>
+ <div class="card-action">
+ <a class="btn-flat waves-effect" href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=image.pk %}">
+ {% trans "Edit" context "Dashboard edit action" %}
+ </a>
+ <a href="#base-modal" class="btn-flat waves-effect modal-trigger-custom" data-href="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=image.pk %}">
+ {% trans "Remove" context "Dashboard remove action" %}
+ </a>
+ </div>
</div>
</div>
- </div>
- </li>
- {% endfor %}
- {% else %}
- <div class="sortable__drag-area"></div>
- {% endif %}
- </ul>
- <div class="col s6 m3 product-gallery-item dropzone-message">
- <div class="row">
- <span class="product-gallery-item-title product-gallery-item-title--noclip card-title black-text">
- <span class="grey-text hide-on-med-and-down">
- {% trans "Drop images here to upload" context "Image gallery upload box text" %}
+ </li>
+ {% endfor %}
+ {% else %}
+ <div class="sortable__drag-area"></div>
+ {% endif %}
+ </ul>
+ <div class="col s6 m3 product-gallery-item dropzone-message">
+ <div class="row">
+ <span class="product-gallery-item-title product-gallery-item-title--noclip card-title black-text">
+ <span class="grey-text hide-on-med-and-down">
+ {% trans "Drop images here to upload" context "Image gallery upload box text" %}
+ </span>
</span>
- </span>
+ </div>
</div>
</div>
- </div>
- </form>
- <script type="application/template" id="template">
- <li class="col s6 m3 product-gallery-item dz-preview dz-file-preview" data-id="{{ image.pk }}">
- <div class="row">
- <div class="card">
- <div class="card-image product-gallery-item-image">
- <img data-dz-thumbnail />
- </div>
- <div class="dz-progress">
- <span class="dz-upload" data-dz-uploadprogress></span>
- </div>
- <div class="card-content">
- <span class="product-gallery-item-title card-title black-text">
- <span class="grey-text">
- {% trans "No description" context "Empty image gallery message" %}
+ </form>
+ <script type="application/template" id="template">
+ <li class="col s6 m3 product-gallery-item dz-preview dz-file-preview" data-id="{{ image.pk }}">
+ <div class="row">
+ <div class="card">
+ <div class="card-image product-gallery-item-image">
+ <img data-dz-thumbnail />
+ </div>
+ <div class="dz-progress">
+ <span class="dz-upload" data-dz-uploadprogress></span>
+ </div>
+ <div class="card-content">
+ <span class="product-gallery-item-title card-title black-text">
+ <span class="grey-text">
+ {% trans "No description" context "Empty image gallery message" %}
+ </span>
</span>
- </span>
- </div>
- <div class="sortable__drag-area"></div>
- <div class="card-action">
- <a class="btn-flat waves-effect card-action-edit" href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=0 %}">
- {% trans "Edit" context "Dashboard edit action" %}
- </a>
- <a href="#base-modal" class="btn-flat waves-effect card-action-delete modal-trigger-custom"
- data-href="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=0 %}">
- {% trans "Remove" context "Dashboard remove action" %}
- </a>
+ </div>
+ <div class="sortable__drag-area"></div>
+ <div class="card-action">
+ <a class="btn-flat waves-effect card-action-edit" href="{% url 'dashboard:product-image-update' product_pk=product.pk img_pk=0 %}">
+ {% trans "Edit" context "Dashboard edit action" %}
+ </a>
+ <a href="#base-modal" class="btn-flat waves-effect card-action-delete modal-trigger-custom"
+ data-href="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=0 %}">
+ {% trans "Remove" context "Dashboard remove action" %}
+ </a>
+ </div>
</div>
</div>
- </div>
- </li>
- </script>
+ </li>
+ </script>
+ </div>
</div>
{% endblock %}