Skip to content

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

Add modal to delete address

weronka0d49d888939a
diff --git a/saleor/static/scss/demo/components/_userprofile.scss b/saleor/static/scss/demo/components/_userprofile.scss
index 101da6a4c8..71e8e44ada 100644
--- a/saleor/static/scss/demo/components/_userprofile.scss
+++ b/saleor/static/scss/demo/components/_userprofile.scss
@@ -35,13 +35,14 @@
&__address-row {
padding: $global-padding 0;
border-bottom: 1px solid $light-gray;
- &:last-of-type {
- margin-bottom: $global-margin * 2;
- }
img {
margin-left: $global-margin;
+ float: right;
}
}
+ .primary {
+ margin-top: $global-margin;
+ }
&__orders {
small {
text-decoration: underline;
@@ -66,4 +67,18 @@
.btn {
margin-top: $global-margin;
}
+}
+
+.modal-address-delete {
+ .modal-header {
+ padding-top: $global-padding * 2;
+ border-bottom: 0;
+ }
+ .modal-footer {
+ border-top: 0;
+ padding-bottom: $global-padding;
+ button {
+ margin-left: $global-margin * 2;
+ }
+ }
}
\ No newline at end of file
diff --git a/templates/userprofile/address-delete.html b/templates/userprofile/address-delete.html
index 86252321dc..bd5757b9d5 100644
--- a/templates/userprofile/address-delete.html
+++ b/templates/userprofile/address-delete.html
@@ -1,32 +1,21 @@
-{% extends "base.html" %}
{% load i18n %}
-{% block title %}{% trans "Delete address" %} — {{ block.super }}{% endblock %}
-
-{% block breadcrumb %}
- <ul class="breadcrumbs list-unstyled">
- <li><a href="{% url 'profile:details' %}">{% trans "Your profile" %}</a></li>
- <li><a href=".">{% trans "Delete address" %}</a></li>
- </ul>
-{% endblock breadcrumb %}
-
-{% block content %}
- <div class="row">
- <div class="col-sm-8 col-md-6 offset-sm-2 offset-md-3">
- <h1 class="text-xs-center">{% trans "Are you sure you want to delete the following address?" %}</h1>
- <div class="panel panel-default">
- <div class="panel-heading">
- {{ address }}
- </div>
- <div class="panel-body">
- <address>{% include "userprofile/snippets/address-details.html" with address=address %}</address>
- </div>
- </div>
- <form method="post" novalidate>
- {% csrf_token %}
- <button type="submit" class="btn danger">{% trans "Delete" %}</button>
- <a href="{% url 'profile:details' %}" class="btn secondary">{% trans "Cancel" %}</a>
- </form>
- </div>
+<div class="modal fade modal-address-delete" tabindex="-1" role="dialog" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h3 class="text-xs-center">{% trans "Are you sure you want to delete the following address?" %}</h3>
+ </div>
+ <div class="modal-body text-xs-center">
+ <address>{% include "userprofile/snippets/address-short.html" with address=address %}</address>
+ </div>
+ <div class="modal-footer">
+ <form method="post" novalidate>
+ {% csrf_token %}
+ <a href="{% url 'profile:details' %}" class="btn btn-link">{% trans "Cancel" %}</a>
+ <button type="submit" class="btn danger">{% trans "Delete" %}</button>
+ </form>
+ </div>
</div>
-{% endblock content %}
+ </div>
+</div>
\ No newline at end of file
diff --git a/templates/userprofile/details.html b/templates/userprofile/details.html
index a26382200c..13ba1f71ef 100644
--- a/templates/userprofile/details.html
+++ b/templates/userprofile/details.html
@@ -37,7 +37,7 @@
<div class="tab-pane active" id="addresses" role="tabpanel">
{% for address in addresses %}
<div class="row userprofile__address-row">
- <div class="col-xs-5">
+ <div class="col-xs-6">
{% include "userprofile/snippets/address-short.html" %}
</div>
<div class="col-xs-3 col-md-4">
@@ -65,17 +65,18 @@
</div>
</div>
<div class="col-md-2 col-xs-4">
+ <a data-toggle="modal" data-target=".modal-address-delete" href="{% url 'profile:address-delete' pk=address.pk %}"><img src="{% static 'img/icon_delete.svg' %}"></a>
<a href="{% url 'profile:address-edit' pk=address.pk %}"><img src="{% static 'img/icon_edit.svg' %}"></a>
- <a href="{% url 'profile:address-delete' pk=address.pk %}"><img src="{% static 'img/icon_delete.svg' %}"></a>
</div>
</div>
+ {% include "userprofile/address-delete.html" %}
{% endfor %}
{% if addresses|length == 0 %}
<div class="userprofile__address-empty">
<p>{% trans "Add shipping and billing addresses for better shopping experience." %}</p>
</div>
{% endif %}
- <a href="{% url 'profile:address-create' %}" class="btn primary ">{% trans "Add new address" %}</a>
+ <a href="{% url 'profile:address-create' %}" class="btn primary">{% trans "Add new address" %}</a>
</div>
<div class="tab-pane" id="orders" role="tabpanel">
<div id="accordion" role="tablist" aria-multiselectable="true">