Skip to content

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

Table row should be clickable

Maciek Jabłoński755ae0680673
diff --git a/saleor/static/js/dashboard.js b/saleor/static/js/dashboard.js
index 8c73c44a36..d3cfb7803e 100644
--- a/saleor/static/js/dashboard.js
+++ b/saleor/static/js/dashboard.js
@@ -204,6 +204,11 @@ function initSelects() {
$('select:not(.browser-default):not([multiple])').material_select();
$('select[multiple]:not(.browser-default)').select2({width: '100%'});
}
+// Clickable rows in dashboard tables
+$(document).on('click', 'tr[data-action-go]>td:not(.ignore-link)', function(){
+ let target = $(this).parent();
+ window.location.href = target.data('action-go');
+});
// Coupon dynamic forms
$(document).ready(() => {
diff --git a/saleor/static/scss/dashboard/dashboard.scss b/saleor/static/scss/dashboard/dashboard.scss
index 029d0854af..d73e0b6708 100644
--- a/saleor/static/scss/dashboard/dashboard.scss
+++ b/saleor/static/scss/dashboard/dashboard.scss
@@ -79,6 +79,10 @@ $roboto-font-path: "~materialize-css/fonts/roboto/";
}
}
+tr[data-action-go]>td:not(.ignore-link):hover {
+ cursor: pointer;
+}
+
#modal-product-class {
max-width: 300px;
}
diff --git a/templates/dashboard/customer/detail.html b/templates/dashboard/customer/detail.html
index cb5250c466..ab69477008 100644
--- a/templates/dashboard/customer/detail.html
+++ b/templates/dashboard/customer/detail.html
@@ -48,8 +48,8 @@
</thead>
<tbody>
{% for order in customer_orders %}
- <tr>
- <td><a href="{% url 'dashboard:order-details' order_pk=order.pk %}">{{ order }}</a></td>
+ <tr data-action-go="{% url 'dashboard:order-details' order_pk=order.pk %}">
+ <td>{{ order }}</td>
<td>{{ order.created }}</td>
<td>{% render_status order.status order.get_status_display %}</td>
<td class="right-align">{% gross order.get_total html=True %}</td>
diff --git a/templates/dashboard/customer/list.html b/templates/dashboard/customer/list.html
index 6c4d8fb2fe..6860ff0ff3 100644
--- a/templates/dashboard/customer/list.html
+++ b/templates/dashboard/customer/list.html
@@ -31,10 +31,10 @@
</thead>
<tbody>
{% for customer in customers %}
- <tr>
+ <tr data-action-go="{% url "dashboard:customer-details" pk=customer.pk %}">
{% with customer.default_billing_address as default_address %}
<td>
- <a href="{% url "dashboard:customer-details" pk=customer.pk %}">{{ customer.email }}</a>
+ {{ customer.email }}
</td>
{% if default_address %}
<td>
@@ -50,7 +50,7 @@
<td class="right-align">
{{ customer.num_orders }}
</td>
- <td>
+ <td class="ignore-link">
{% if customer.last_order %}
<a href="{% url 'dashboard:order-details' order_pk=customer.last_order %}">
{% blocktrans with last_order=customer.last_order trimmed context "Customers table last order data" %}
diff --git a/templates/dashboard/discount/sale_list.html b/templates/dashboard/discount/sale_list.html
index 4634b4eaf0..58339d739f 100644
--- a/templates/dashboard/discount/sale_list.html
+++ b/templates/dashboard/discount/sale_list.html
@@ -35,10 +35,8 @@
</thead>
<tbody>
{% for sale in sales %}
- <tr>
- <td>
- <a href="{% url 'dashboard:sale-update' pk=sale.pk %}">{{ sale }}</a>
- </td>
+ <tr data-action-go="{% url 'dashboard:sale-update' pk=sale.pk %}">
+ <td>{{ sale }}</td>
<td>{{ sale.value }}{{ sale.get_type_display }}</td>
</tr>
{% endfor %}
diff --git a/templates/dashboard/discount/voucher_list.html b/templates/dashboard/discount/voucher_list.html
index 63edb31f88..3cbf8de25a 100644
--- a/templates/dashboard/discount/voucher_list.html
+++ b/templates/dashboard/discount/voucher_list.html
@@ -40,10 +40,8 @@
</thead>
<tbody>
{% for voucher in vouchers %}
- <tr>
- <td>
- <a href="{% url 'dashboard:voucher-update' pk=voucher.pk %}">{{ voucher }}</a>
- </td>
+ <tr data-action-go="{% url 'dashboard:voucher-update' pk=voucher.pk %}">
+ <td>{{ voucher }}</td>
<td class="right-align">
{{ voucher.discount_value }}&nbsp;<span class="currency">{{ voucher.get_discount_value_type_display }}</span>
</td>
diff --git a/templates/dashboard/includes/_orders_table.html b/templates/dashboard/includes/_orders_table.html
index a762628e6d..153cf34291 100644
--- a/templates/dashboard/includes/_orders_table.html
+++ b/templates/dashboard/includes/_orders_table.html
@@ -16,10 +16,8 @@
</thead>
<tbody>
{% for order in orders %}
- <tr>
- <td>
- <a href="{% url 'dashboard:order-details' order_pk=order.pk %}">#{{ order.id }}</a>
- </td>
+ <tr data-action-go="{% url 'dashboard:order-details' order_pk=order.pk %}">
+ <td>#{{ order.id }}</td>
<td>{% render_status order.status order.get_status_display %}</td>
<td>{% render_status order.get_last_payment_status order.get_last_payment_status_display %}</td>
{% trans "Guest" context "Customer column anonymous user text" as guest %}
diff --git a/templates/dashboard/index.html b/templates/dashboard/index.html
index 5383abb0a2..7957c2c0b1 100644
--- a/templates/dashboard/index.html
+++ b/templates/dashboard/index.html
@@ -7,6 +7,41 @@
{% block content %}
<div class="row">
<div class="col s12">
+ <div class="card">
+ <div class="data-table-header{% if not preauthorized_payments %} data-table-header--no-data{% endif %}">
+ <span class="data-table-title">{% trans "Preauthorized payments" context "Dashboard homepage table title" %}</span>
+ </div>
+
+ {% if preauthorized_payments %}
+ <div class="data-table-container">
+ <table class="bordered responsive data-table">
+ <thead>
+ <tr>
+ <th>{% trans "Order" context "Preauthorized payments table header" %}</th>
+ <th>{% trans "Date" context "Preauthorized payments table header" %}</th>
+ <th>{% trans "Customer" context "Preauthorized payments table header" %}</th>
+ <th class="right-align">{% trans "Amount" context "Preauthorized payments table header" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for payment in preauthorized_payments %}
+ <tr data-action-go="{% url "dashboard:order-details" order_pk=payment.order.pk %}">
+ <td>{{ payment.order }}</td>
+ <td>{{ payment.created }}</td>
+ <td>{{ payment.order.user|default:_("Guest") }}</td>
+ <td class="right-align">{% gross payment.get_total_price html=True %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ {% else %}
+ <div class="card-content card-content--no-data">
+ <p>{% trans "No preauthorized payments." context "Empty Preauthorized payments table message" %}</p>
+ </div>
+ {% endif %}
+ </div>
+
<div class="card">
<div class="data-table-header{% if not orders_to_ship %} data-table-header--no-data{% endif %}">
<span class="data-table-title">
@@ -36,12 +71,8 @@
</thead>
<tbody>
{% for product in low_stock %}
- <tr>
- <td>
- <a class="list-item-name list-item-name--single" href="{% url "dashboard:product-update" pk=product.pk %}#stock">
- {{ product }}
- </a>
- </td>
+ <tr data-action-go="{% url "dashboard:product-update" pk=product.pk %}#stock">
+ <td>{{ product }}</td>
<td class="right-align">
{{ product.total_stock }}
</td>
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index f4989d4838..3fd17d4d59 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -55,7 +55,7 @@
<a href="#payment-history" role="tab">
<span>{% trans "Payments" context "Order detail tab" %}</span>
<i class="material-icons">payment</i>
- </a>
+ </a>
</li>
<li role="presentation" class="tab col s4">
<a href="#order-history" role="tab">
@@ -404,8 +404,12 @@
<tbody>
{% for payment in all_payments %}
- <tr>
- <td>{{ payment.transaction_id|default:"-" }}</td>
+ <tr data-action-go="{% url "dashboard:payment-details" pk=payment.pk %}">
+ <td>
+ {% blocktrans trimmed with payment_id=payment.id context "Payment item column data" %}
+ #{{ payment_id }}
+ {% endblocktrans %}
+ </td>
<td>{{ payment.created }}</td>
<td>{% render_status payment.status payment.get_status_display %}</td>
<td>{% render_status payment.fraud_status payment.get_fraud_status_display %}</td>
diff --git a/templates/dashboard/product/product_form.html b/templates/dashboard/product/product_form.html
index 63d565cbcc..f80089fa58 100644
--- a/templates/dashboard/product/product_form.html
+++ b/templates/dashboard/product/product_form.html
@@ -211,16 +211,14 @@
<tbody>
{% for variant in variants %}
- <tr>
- <td class="bulk-checkbox">
+ <tr data-action-go="{% url 'dashboard:variant-update' product_pk=product.pk variant_pk=variant.pk %}" title="{% trans "Edit variant" context "Product variant table link title" %}">
+ <td class="bulk-checkbox ignore-link">
<input id="id_variants_{{ variant.id }}" name="items" type="checkbox" value="{{ variant.id }}" class="filled-in switch-actions">
<label for="id_variants_{{ variant.id }}"></label>
</td>
- <td><a class="light-blue-text text-lighten-1"
- title="{% trans "Edit variant" context "Product variant table link title" %}"
- href="{% url 'dashboard:variant-update' product_pk=product.pk variant_pk=variant.pk %}">
+ <td>
{{ variant.sku }}
- </a></td>
+ </td>
{% for attr_display in variant|attributes_values_with_empty:attributes %}
<td>
{{ attr_display }}
@@ -299,16 +297,12 @@
<tbody>
{% for item in stock_items %}
- <tr>
- <td class="bulk-checkbox">
+ <tr data-action-go="{% url 'dashboard:product-stock-update' product_pk=product.pk stock_pk=item.pk %}" title="{% trans "Edit variant" context "Stock table action" %}">
+ <td class="bulk-checkbox ignore-link">
<input name="items" type="checkbox" id="{{ item.id }}" class="filled-in switch-actions" value="{{ item.id }}">
<label for="{{ item.id }}"></label>
</td>
- <td><a class="light-blue-text text-lighten-1"
- title="{% trans "Edit variant" context "Stock table action" %}"
- href="{% url 'dashboard:product-stock-update' product_pk=product.pk stock_pk=item.pk %}">
- {{ item.variant.sku }}
- </a></td>
+ <td>{{ item.variant.sku }}</td>
<td>{{ item.location }}</td>
<td class="right-align">{{ item.quantity }}</td>
<td class="right-align">{{ item.quantity_allocated }}</td>
diff --git a/templates/dashboard/shipping/method_list.html b/templates/dashboard/shipping/method_list.html
index 4a8d84009f..9f72b83542 100644
--- a/templates/dashboard/shipping/method_list.html
+++ b/templates/dashboard/shipping/method_list.html
@@ -36,10 +36,8 @@
</thead>
<tbody>
{% for method in shipping_methods %}
- <tr>
- <td>
- <a href="{% url 'dashboard:shipping-method-detail' pk=method.pk %}">{{ method }}</a>
- </td>
+ <tr data-action-go="{% url 'dashboard:shipping-method-detail' pk=method.pk %}">
+ <td>{{ method }}</td>
<td>
{% if not method.price_range %}
-