Skip to content

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

Add timeline widget

dominik-zeglen0577797c0187
diff --git a/saleor/static/dashboard/scss/components/_global.scss b/saleor/static/dashboard/scss/components/_global.scss
index 762b09e0d8..cd61dfc9f1 100644
--- a/saleor/static/dashboard/scss/components/_global.scss
+++ b/saleor/static/dashboard/scss/components/_global.scss
@@ -1,5 +1,5 @@
html {
- background: #f5f5f5;
+ background: $body-bg;
@media only screen and (min-width: 0) {
font-size: 14px;
}
diff --git a/saleor/static/dashboard/scss/components/_timeline.scss b/saleor/static/dashboard/scss/components/_timeline.scss
new file mode 100644
index 0000000000..111c477e69
--- /dev/null
+++ b/saleor/static/dashboard/scss/components/_timeline.scss
@@ -0,0 +1,91 @@
+$timeline-width: 3px !default;
+$timeline-circle-radius: 6px !default;
+$timeline-event-margin: 30px !default;
+
+.timeline-outer {
+ padding-left: 180px;
+ .timeline {
+ border-left: $timeline-width solid $primary-color-light;
+ position: relative;
+ list-style: none;
+ h1, h2, h3 {
+ font-size: 1.4em;
+ }
+ .event {
+ padding-bottom: 15px;
+ margin-bottom: $timeline-event-margin;
+ position: relative;
+ &:before, &:after {
+ position: absolute;
+ display: block;
+ }
+ &:before {
+ left: -10rem;
+ content: attr(data-date);
+ text-align: right;
+ top: calc(#{$timeline-circle-radius} + #{$timeline-width} + .5px - #{$label-font-size} + .1rem);
+ }
+ &:after {
+ box-shadow: 0 0 0 $timeline-width $primary-color-light;
+ left: - $timeline-circle-radius - ($timeline-width / 2) - 1;
+ background: $body-bg;
+ border-radius: 50%;
+ height: 2 * $timeline-circle-radius + 1;
+ width: 2 * $timeline-circle-radius + 1;
+ content: "";
+ top: $timeline-width;
+ }
+ &:last-of-type {
+ padding-bottom: 0;
+ margin-bottom: 0;
+ border: none;
+ }
+ .content {
+ margin-left: 3rem;
+ padding-left: 200px;
+ position: relative;
+ top: calc(#{$timeline-circle-radius} + #{$timeline-width} + .5px - #{$label-font-size} + .1rem);
+ }
+ .status {
+ position: absolute;
+ left: 0;
+ top: 0;
+ }
+ }
+ }
+}
+
+@media (max-width: 768px) {
+ .timeline-outer {
+ padding-left: 0;
+ margin: 0 1rem;
+ .timeline {
+ .event {
+ margin-bottom: $timeline-event-margin / 2;
+ &:before {
+ left: 3rem;
+ top: calc(#{$timeline-circle-radius} + #{$timeline-width} + .5px - #{$label-font-size} + .7rem);
+ min-width: 0;
+ }
+ .content {
+ position: relative;
+ top: calc(#{$timeline-circle-radius} + #{$timeline-width} + .5px - #{$label-font-size} - .5rem);
+ }
+ }
+ }
+ }
+}
+
+@media (max-width: $small-screen) {
+ .timeline-outer {
+ .timeline {
+ .event {
+ .content {
+ padding-left: 0;
+ top: calc(#{$timeline-circle-radius} + #{$timeline-width} + .5px - #{$label-font-size} - .5rem);
+ padding-top: 3rem;
+ }
+ }
+ }
+ }
+}
diff --git a/saleor/static/dashboard/scss/dashboard.scss b/saleor/static/dashboard/scss/dashboard.scss
index fa29df4154..0c5e108c01 100644
--- a/saleor/static/dashboard/scss/dashboard.scss
+++ b/saleor/static/dashboard/scss/dashboard.scss
@@ -20,6 +20,7 @@
@import "components/select2";
@import "components/search";
@import "components/tabs";
+@import "components/timeline";
@import "layouts/style-guide";
@import "print";
diff --git a/saleor/static/dashboard/scss/variables.scss b/saleor/static/dashboard/scss/variables.scss
index 4aae92c8ea..4e220993e1 100644
--- a/saleor/static/dashboard/scss/variables.scss
+++ b/saleor/static/dashboard/scss/variables.scss
@@ -21,6 +21,7 @@ $link-color: #039BE5;
$grey-color: #9E9E9E;
$sidenav-font-color: #616161;
$placeholder-text-color: white;
+$body-bg: #f5f5f5;
/*** PADDINGS ***/
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 3a05a10476..bfe25e2d15 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -526,47 +526,20 @@
</p>
{% endif %}
</div>
- <div class="card tab-content" id="order-history">
+ <div class="tab-content" id="order-history">
<p class="print-show print-tabs">{% trans "History" context "Order detail tab" %}</p>
- <div class="data-table-container">
- <table class="bordered highlight responsive data-table">
- <thead>
- <tr>
- <th>
- {% trans "Date" context "Order history table header" %}
- </th>
- <th>
- {% trans "Order status" context "Order history table header" %}
- </th>
- <th>
- {% trans "User" context "Order history table header" %}
- </th>
- <th class="wide">
- {% trans "Comment" context "Order history table header" %}
- </th>
- </tr>
- </thead>
- <tbody>
- {% for event in order.history.all %}
- <tr>
- <td>
- {{ event.date }}
- </td>
- <td>
+ <div class="timeline-outer">
+ <ul class="timeline">
+ {% for event in order.history.all %}
+ <li class="event" data-date="{{ event.date|datetimefmt:"dd/mm/yy HH:MM" }}">
+ <div class="content">
+ {{ event.comment|default:"&nbsp;" }}{% if event.user %} by {{ event.user }}{% endif %}
+ <div class="status">
{% render_status event.status event.get_status_display %}
- </td>
- <td>
- {% if event.user %}
- {{ event.user }}
- {% endif %}
- </td>
- <td>
- {{ event.comment|default:"" }}
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
+ </div>
+ </div>
+ </li>
+ {% endfor %}
+ </ul>
</div>
{% endblock %}