Skip to content

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

Improve product image form

Paweł Kowalewski66f9ad120191
diff --git a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
index 78ec48fa56..7fda8d3d40 100644
--- a/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
+++ b/saleor/dashboard/templates/dashboard/product/product_confirm_delete.html
@@ -1,44 +1,39 @@
{% extends "dashboard/base.html" %}
{% load i18n %}
-{% load images %}
{% load prices_i18n %}
+{% load staticfiles %}
{% block title %}{% trans "Delete product" %} - {{ block.super }}{% endblock %}
-{% block content %}
-
-<form class="form form-horizontal" action="" method="post">
- {% csrf_token %}
-
- <div class="row">
- <div class="col-lg-12">
- <h1 class="page-header">{% trans "Are you sure you want to delete the following product?" %}</h1>
- </div>
- </div>
+{% block page_title %}{% trans "Are you sure you want to delete the following product?" %}{% endblock %}
- <div class="row">
- <div class="col-md-6">
- <div class="panel panel-default">
- <div class="panel-heading">{{ object }}</div>
- <div class="panel-body">
- {% if object.images.exists %}
- <img src="{{ product.images.first|at_size:"admin" }}" alt="">
- {% else %}
- <img src="http://placehold.it/50x50/&text=Product Image" alt="">
- {% endif %}
- <strong>{{ object.name }}</strong>
- <span>{{ object.collection }}</span>
+{% block content %}
+ <form action="" method="post">
+ {% csrf_token %}
+ <div class="row">
+ <div class="col m6 l4 offset-m3 offset-l4">
+ <div class="card">
+ <div class="card-content">
+ <div class="card-title black-text">{{ object }}</div>
+ {% if object.images.exists %}
+ <img src="{{ product.images.first.image.crop.350x350 }}" alt="" class="responsive-img">
+ {% else %}
+ <img src="{% static 'placeholders/product-image-placeholder.png' %}" alt="" class="responsive-img">
+ {% endif %}
+ <p>{{ object.collection }}</p>
+ </div>
</div>
</div>
</div>
- </div>
- <div class="form-group">
- <div class="col-md-6">
- <button class="btn btn-danger" type="submit"><i class="glyphicon glyphicon-trash"></i> {% trans "Delete" %}</button>
- <a class="btn btn-default" href="{% url 'dashboard:product-update' pk=product.pk %}"><i class="glyphicon glyphicon-remove"></i> {% trans "Cancel" %}</a>
- </div>
- </div>
-</form>
+ <div class="row">
+ <div class="col m6 l4 offset-m3 offset-l4 right-align">
+ <a href="{% url 'dashboard:products' %}" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
+ <button type="submit" class="btn materialize-red"><i class="mdi-action-delete"></i> {% trans "Delete" %}</button>
+{# <button class="btn btn-danger" type="submit"><i class="glyphicon glyphicon-trash"></i> {% trans "Delete" %}</button>#}
+{# <a class="btn btn-default" href="{% url 'dashboard:products' pk=product.pk %}"><i class="glyphicon glyphicon-remove"></i> {% trans "Cancel" %}</a>#}
+ </div>
+ </div>
+ </form>
{% endblock %}
diff --git a/saleor/dashboard/templates/dashboard/product/product_image_form.html b/saleor/dashboard/templates/dashboard/product/product_image_form.html
index 995db96830..0a41d9a0a1 100644
--- a/saleor/dashboard/templates/dashboard/product/product_image_form.html
+++ b/saleor/dashboard/templates/dashboard/product/product_image_form.html
@@ -1,5 +1,6 @@
{% extends "dashboard/base.html" %}
{% load i18n %}
+{% load materializecss %}
{% load static %}
{% block title %}{{ title }} - {% trans "Images" %} - {{ block.super }}{% endblock %}
@@ -9,25 +10,23 @@
{% block content %}
<form method="post" id="product-form" enctype="multipart/form-data">
<div class="row">
- <div class="col l8">
- {% csrf_token %}
- {{ form }}
- <input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#images">
+ <div class="col l8 offset-l2">
+ <div class="row">
+ {% csrf_token %}
+ {{ form|materializecss }}
+ <input type="hidden" name="success_url" value="{% url 'dashboard:product-update' pk=product.pk %}#images">
+ </div>
</div>
</div>
+
<div class="row">
- <div class="col l8">
- {% if product_image.pk %}
- <span class="right">
- <a href="{% url 'dashboard:product-image-delete' product_pk=product.pk img_pk=product_image.pk %}" class="btn waves-effect red"><i class="glyphicon glyphicon-trash"></i> {% trans "Delete" %}</a>
- </span>
- {% endif %}
+ <div class="col l8 offset-l2 right-align">
+ <a href="{% url 'dashboard:product-update' pk=product.pk %}#images" class="btn-flat"><i class="mdi-content-clear"></i> {% trans "Cancel" %}</a>
{% if product_image.pk %}
- <button type="submit" class="btn waves-effect"><i class="glyphicon glyphicon-refresh"></i> {% trans "Update" %}</button>
+ <button type="submit" class="btn"><i class="mdi-content-save"></i> {% trans "Update" %}</button>
{% else %}
- <button type="submit" class="btn waves-effect"><i class="glyphicon glyphicon-upload"></i> {% trans "Add" %}</button>
+ <button type="submit" class="btn"><i class="mdi-content-create"></i> {% trans "Create" %}</button>
{% endif %}
- <a href="{% url 'dashboard:product-update' pk=product.pk %}#images" class="btn waves-effect"><i class="glyphicon glyphicon-remove"></i> {% trans "Cancel" %}</a>
</div>
</div>
</form>
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
index 4108ffa556..35a1832d02 100644
--- a/saleor/static/scss/_app.scss
+++ b/saleor/static/scss/_app.scss
@@ -1,6 +1,8 @@
$roboto-font-path: "../fonts/";
$icons-font-path: $roboto-font-path;
+$font-size-action-icon: 18px;
+
/**
* @license
* MyFonts Webfont Build ID 2917526, 2014-11-07T07:08:31-0500
diff --git a/saleor/static/scss/widget/_product-gallery.scss b/saleor/static/scss/widget/_product-gallery.scss
index 0d29fc697a..ebf8b4d2d8 100644
--- a/saleor/static/scss/widget/_product-gallery.scss
+++ b/saleor/static/scss/widget/_product-gallery.scss
@@ -36,7 +36,7 @@
&-create, &-remove {
bottom: 0;
- font-size: 20px;
+ font-size: $font-size-action-icon;
line-height: 48px;
position: absolute;
right: 0;
diff --git a/saleor/static/scss/widget/_product-list.scss b/saleor/static/scss/widget/_product-list.scss
index 4f8cec65dd..2cfb24f917 100644
--- a/saleor/static/scss/widget/_product-list.scss
+++ b/saleor/static/scss/widget/_product-list.scss
@@ -4,7 +4,7 @@
&-delete {
background: white;
- font-size: 18px;
+ font-size: $font-size-action-icon;
@media (min-width: $medium-screen-up) {
padding-left: 50px;