Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add basic styles to userprofile
weronka8ec20033919f
diff --git a/saleor/static/img/icon_edit.svg b/saleor/static/img/icon_edit.svgnew file mode 100644index 0000000000..3f4f4ef811--- /dev/null+++ b/saleor/static/img/icon_edit.svg@@ -0,0 +1,35 @@+<svg width="21" height="20" viewBox="0 0 21 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:figma="http://www.figma.com/figma/ns">+<title>icon_pen_03 2</title>+<desc>Created using Figma</desc>+<g id="Canvas" transform="translate(-3658 -3610)" figma:type="canvas">+<rect x="3658" y="3610" width="21" height="20" fill="#E5E5E5"/>+<mask id="mask0_alpha" mask-type="alpha">+<path d="M 2790 3078L 3930 3078L 3930 4099L 2790 4099L 2790 3078Z" fill="#FFFFFF"/>+</mask>+<g id="My Account" style="mix-blend-mode:normal;" mask="url(#mask0_alpha)" figma:type="frame">+<path d="M 2790 3078L 3930 3078L 3930 4099L 2790 4099L 2790 3078Z" fill="#FFFFFF"/>+<g id="icon_pen_03 2" style="mix-blend-mode:normal;" figma:type="frame">+<g id="Group" style="mix-blend-mode:normal;" figma:type="frame">+<g id="Vector" style="mix-blend-mode:normal;" figma:type="vector">+<use xlink:href="#path0_fill" transform="translate(3658.01 3627.71)" fill="#828282" style="mix-blend-mode:normal;"/>+</g>+<g id="Vector" style="mix-blend-mode:normal;" figma:type="vector">+<use xlink:href="#path1_fill" transform="translate(3659.03 3624.49)" fill="#828282" style="mix-blend-mode:normal;"/>+</g>+<g id="Vector" style="mix-blend-mode:normal;" figma:type="vector">+<use xlink:href="#path2_fill" transform="matrix(-0.707329 -0.70697 0.707229 -0.707071 3664 3627.6)" fill="#828282" style="mix-blend-mode:normal;"/>+</g>+<g id="Vector" style="mix-blend-mode:normal;" figma:type="vector">+<use xlink:href="#path3_fill" transform="translate(3672.61 3610)" fill="#828282" style="mix-blend-mode:normal;"/>+</g>+</g>+</g>+</g>+</g>+<defs>+<path id="path0_fill" d="M -3.14582e-08 2.28841L 2.28925 1.52341L 0.765282 -9.55979e-07L -3.14582e-08 2.28841Z"/>+<path id="path1_fill" d="M 1.79555 4.48889L 4.49164 3.5887L 0.900526 -4.02517e-07L -3.25068e-08 2.69399L 1.79555 4.48889Z"/>+<path id="path2_fill" d="M 5.07676 0L 0 0L 0 16.5748L 5.07676 16.5748L 5.07676 0Z"/>+<path id="path3_fill" d="M 3.59111 5.40451L 5.24372 3.7536C 5.24372 3.7536 5.72312 3.27438 5.00402 2.55664L 2.85002 0.403419C 2.85002 0.403419 2.13201 -0.31432 1.65261 0.164906L -4.27831e-07 1.81582L 3.59111 5.40451Z"/>+</defs>+</svg>diff --git a/saleor/static/scss/demo/components/_userprofile.scss b/saleor/static/scss/demo/components/_userprofile.scssnew file mode 100644index 0000000000..41c7a623be--- /dev/null+++ b/saleor/static/scss/demo/components/_userprofile.scss@@ -0,0 +1,68 @@+.userprofile {+ &__nav {+ background-color: $light-gray;+ padding: $global-padding 0;+ margin-bottom: $global-margin;+ .nav-link {+ color: $gray;+ border-bottom: 0;+ &:first-of-type {+ margin-right: $global-margin * 3;+ }+ &.active, &.active:hover, &.active:focus {+ background-color: transparent;+ border: 0;+ color: $body-color;+ }+ }+ ul {+ border-bottom: 0;+ }+ }+ &__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;+ }+ }+ &__orders {+ border: 0;+ a {+ color: $body-color;+ }+ .card-header {+ background-color: transparent;+ border: 0;+ border-bottom: 1px solid $light-gray;+ padding-left: 0;+ padding-right: 0;+ }+ .collapsed {+ .card-header {+ border-color: $gray;+ .userprofile__orders__arrow-icon {+ transform: rotate(90deg);+ }+ }+ }+ &__arrow-icon {+ width: 10px;+ transform: rotate(270deg);+ transition: 0.3s;+ margin-right: $global-margin / 2;+ }+ .card-block {+ padding-left: 0;+ padding-right: 0;+ }+ &__details {+ address {+ color: $gray;+ }+ }+ }+}\ No newline at end of filediff --git a/saleor/static/scss/demo/storefront.scss b/saleor/static/scss/demo/storefront.scssindex 375115f14f..5815244fb5 100644--- a/saleor/static/scss/demo/storefront.scss+++ b/saleor/static/scss/demo/storefront.scss@@ -8,4 +8,5 @@@import "components/footer";@import "components/home";@import "components/product-page";-@import "components/cart";\ No newline at end of file+@import "components/cart";+@import "components/userprofile";\ No newline at end of filediff --git a/saleor/userprofile/urls.py b/saleor/userprofile/urls.pyindex da949ec636..8d387febe6 100644--- a/saleor/userprofile/urls.py+++ b/saleor/userprofile/urls.py@@ -5,7 +5,6 @@ from . import viewsurlpatterns = [url(r'^$', views.details, name='details'),- url(r'^orders/$', views.orders, name='orders'),url(r'^address/create/$', views.address_create,name='address-create'),url(r'^address/(?P<pk>\d+)/edit/$', views.address_edit,diff --git a/saleor/userprofile/views.py b/saleor/userprofile/views.pyindex 4542569665..2cd2824530 100755--- a/saleor/userprofile/views.py+++ b/saleor/userprofile/views.py@@ -12,16 +12,10 @@ from .forms import get_address_form@login_requireddef details(request):- ctx = {'addresses': request.user.addresses.all()}+ ctx = {'addresses': request.user.addresses.all(),+ 'orders': request.user.orders.prefetch_related('groups__items')}return TemplateResponse(request, 'userprofile/details.html', ctx)--@login_required-def orders(request):- ctx = {'orders': request.user.orders.prefetch_related('groups__items')}- return TemplateResponse(request, 'userprofile/orders.html', ctx)--@login_requireddef address_edit(request, pk):address = get_object_or_404(request.user.addresses, pk=pk)diff --git a/templates/demo/userprofile/details.html b/templates/demo/userprofile/details.htmlindex d14771b29d..f736207f99 100644--- a/templates/demo/userprofile/details.html+++ b/templates/demo/userprofile/details.html@@ -1,70 +1,189 @@{% extends "base.html" %}{% load i18n %}+{% load static from staticfiles %}+{% load gross from prices_i18n %}+{% load discount_amount_for from prices %}{% block title %}{% trans "Your profile" %} — {{ block.super }}{% endblock %}{% block breadcrumb %}- {{ block.super }}- <li><a href="{% url 'profile:details' %}">{% trans "Your profile" %}</a></li>+ <ul class="breadcrumbs list-unstyled">+ <li><a href="/">{% trans "Home" %}</a></li>+ <li><a href="{% url 'profile:details' %}">{% trans "Your account" %}</a></li>+ </ul>{% endblock breadcrumb %}{% block content %}- <h2>{% trans "Profile" %}</h2>- <p>- <a href="{% url 'registration:change_password' %}" class="btn btn-default">{% trans 'Change your password' %}</a>- <a href="{% url 'registration:request_email_change' %}" class="btn btn-default">{% trans 'Change your email address' %}</a>- </p>--- <h3>{% trans "Your address book" %}</h3>- <table class="table table-striped">- <thead>- <tr>- <th class="col-sm-6">{% trans "Addressee" %}</th>- <th class="col-sm-2">{% trans "Billing" %}</th>- <th class="col-sm-2">{% trans "Shipping" %}</th>- <th class="col-sm-2"></th>- </tr>- </thead>- <tbody>- {% for address in addresses %}- <tr>- <th class="col-sm-6">- {{ address }}- </th>- <td class="col-sm-2">- {% if user.default_billing_address == address %}- <span class="label label-default">{% trans "Default" %}</span>- {% else %}- <form method="post" action="{% url "profile:address-make-default" pk=address.pk purpose="billing" %}" class="form-inline form-horizontal" novalidate>- {% csrf_token %}- <button type="submit" class="btn btn-default btn-sm">{% trans "Make default" %}</button>- </form>- {% endif %}- </td>- <td class="col-sm-2">- {% if user.default_shipping_address == address %}- <span class="label label-default">{% trans "Default" %}</span>- {% else %}- <form method="post" action="{% url "profile:address-make-default" pk=address.pk purpose="shipping" %}" class="form-inline form-horizontal" novalidate>- {% csrf_token %}- <button type="submit" class="btn btn-default btn-sm">{% trans "Make default" %}</button>- </form>- {% endif %}- </td>- <td class="col-sm-2">- <a href="{% url 'profile:address-edit' pk=address.pk %}" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-edit"></i> {% trans "Edit" %}</a>- <a href="{% url 'profile:address-delete' pk=address.pk %}" class="btn btn-danger btn-sm"><i class="glyphicon glyphicon-remove"></i> {% trans "Delete" %}</a>- </td>- </tr>- {% endfor %}- </tbody>- </table>-- <div>- <a href="{% url 'profile:address-create' %}" class="btn btn-default"><i class="glyphicon glyphicon-plus-sign"></i> {% trans "Add new address" %}</a>+ <div class="userprofile">+ <div class="row">+ <div class="col-md-10 offset-md-1">+ <h3>{{ user }}</h3>+ <p>+ <a href="{% url 'registration:change_password' %}">{% trans 'Change your password' %}</a>+ <a href="{% url 'registration:request_email_change' %}">{% trans 'Change your email address' %}</a>+ </p>+ </div></div>--+ <div class="userprofile__nav">+ <div class="row">+ <ul class="nav nav-tabs col-md-10 offset-md-1" role="tablist">+ <li class="nav-item">+ <a class="nav-link active" data-toggle="tab" href="#addresses" role="tab"><h3>{% trans "Addresses" %}</h3></a>+ </li>+ <li class="nav-item">+ <a class="nav-link" data-toggle="tab" href="#orders" role="tab"><h3>{% trans "Last orders" %}</h3></a>+ </li>+ </ul>+ </div>+ </div>+ <div class="row">+ <div class="tab-content col-md-10 offset-md-1">+ <div class="tab-pane active" id="addresses" role="tabpanel">+ {% for address in addresses %}+ <div class="row userprofile__address-row">+ <div class="col-md-6">+ {{ address }}+ </div>+ <div class="col-md-2">+ {% if user.default_billing_address == address %}+ <span class="label label-default">{% trans "Billing" %}</span>+ {% else %}+ <form method="post" action="{% url "profile:address-make-default" pk=address.pk purpose="billing" %}" class="form-inline form-horizontal" novalidate>+ {% csrf_token %}+ <button type="submit" class="btn btn-default btn-sm">{% trans "Billing" %}</button>+ </form>+ {% endif %}+ </div>+ <div class="col-md-2">+ {% if user.default_shipping_address == address %}+ <span class="label label-default">{% trans "Shipping" %}</span>+ {% else %}+ <form method="post" action="{% url "profile:address-make-default" pk=address.pk purpose="shipping" %}" class="form-inline form-horizontal" novalidate>+ {% csrf_token %}+ <button type="submit" class="btn btn-default btn-sm">{% trans "Shipping" %}</button>+ </form>+ {% endif %}+ </div>+ <div class="col-md-2">+ <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>+ {% endfor %}+ <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">+ {% for order in orders %}+ <div class="card userprofile__orders">+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse{{ forloop.counter0 }}" aria-expanded="true" aria-controls="collapse{{ forloop.counter0 }}">+ <div class="card-header" role="tab" id="head{{ forloop.counter0 }}">++ <div class="row">+ <div class="col-md-2 col-xs-2">+ <strong>{{ order }}</strong>+ </div>+ <div class="col-md-3 col-xs-7">+ {{ order.created }}+ </div>+ <div class="col-md-3 col-xs-3">+ {% gross order.get_total %}+ </div>+ <div class="col-md-3 col-xs-6">+ <span class="label label-default">{{ order.get_status_display }}</span>+ </div>+ <div class="col-md-1 col-xs-6">+ <img class="userprofile__orders__arrow-icon float-xs-right" src="{% static 'img/gallery-arrow.svg' %}">+ </div>+ </div>+ </div>+ </a>+ <div id="collapse{{ forloop.counter0 }}" class="collapse{% if forloop.counter0 == 0 %} in{% endif %} userprofile__orders__details" role="tabpanel" aria-labelledby="head{{ forloop.counter0 }}">+ <div class="card-block">+ <div class="row">+ <div class="col-md-3 col-xs-6">+ <h3>{% trans "Shipping address" %}</h3>+ <address>{% include "userprofile/snippets/address-details.html" with address=order.shipping_address %}</address>+ </div>+ <div class="col-md-3 col-xs-6">+ <h3>{% trans "Billing address" %}</h3>+ <address>{% include "userprofile/snippets/address-details.html" with address=order.billing_address %}</address>+ </div>+ </div>+ <!-- {% for group in groups %}+ <div class="panel panel-default">+ <div class="panel-heading">+ {% blocktrans with number=forloop.counter %}Shipment #{{ number }}{% endblocktrans %}+ <span class="pull-right">+ <span class="label label-default">{{ group.get_status_display }}</span>+ </span>+ </div>+ <table class="table">+ <thead>+ <tr>+ <th class="col-sm-6">{% trans "Name" %}</th>+ <th class="col-sm-3 text-right">{% trans "Price" %}</th>+ <th class="col-sm-3 text-right">{% trans "Subtotal" %}</th>+ </tr>+ </thead>+ <tfoot>+ <tr>+ <th colspan="2">{% trans "Total" %}</th>+ <th class="text-right">{% gross group.get_total %}</th>+ </tr>+ </tfoot>+ <tbody>+ {% for item in group %}+ <tr>+ <td>{{ item.product }}{% if item.quantity != 1 %} <em>×{{ item.quantity }}</em>{% endif %}</td>+ <td class="text-right">{% gross item.get_price_per_item %}</td>+ <td class="text-right">{% gross item.get_total %}</td>+ </tr>+ {% endfor %}+ {% if group.shipping_price.gross %}+ <tr>+ <td class="col-sm-4">+ {% trans "Shipping" %}+ </td>+ <td class="text-right">{% gross group.shipping_price %}</td>+ <td class="text-right">{% gross group.shipping_price %}</td>+ </tr>+ {% endif %}+ </tbody>+ </table>+ </div>+ {% endfor %}+ {% if order.discount_amount %}+ <div class="panel panel-default">+ <div class="panel-heading">+ {{ order.discount_name }}+ </div>+ <div class="panel-body text-right">+ <strong>{% gross order.discount|discount_amount_for:order.total %}</strong>+ </div>+ </div>+ {% endif %}+ {% if order.discount_amount or groups|length > 1 %}+ <div class="panel panel-default">+ <div class="panel-heading">+ {% trans "Total" %}+ </div>+ <div class="panel-body text-right">+ <strong>{% gross order.total %}</strong>+ </div>+ </div>+ {% endif %}+ -->+ </div>+ </div>+ </div>+ {% endfor %}++ </div>++ </div>+ </div>+ </div>+ </div>{% endblock content %}