From 2b01102025b51e7b4b4e750e43e006b07a738ac4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 22 Jan 2018 20:38:13 +0100 Subject: UI: manage multi select on table - improve basket management layout --- ishtar_common/forms_common.py | 3 ++- ishtar_common/static/media/styles.css | 2 ++ ishtar_common/templates/base.html | 1 + ishtar_common/templates/blocks/DataTables.html | 22 ++++++++++----- .../templates/blocks/bs_form_snippet.html | 2 +- ishtar_common/templates/ishtar/basket_list.html | 21 ++++++++++----- ishtar_common/templates/ishtar/manage_basket.html | 31 +++++++++++++++------- 7 files changed, 58 insertions(+), 24 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 2b30c56f6..fae4d54d3 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -111,7 +111,8 @@ class NewImportForm(forms.ModelForm): model = models.Import fields = ( 'name', 'importer_type', 'imported_file', 'imported_images', - 'associated_group', 'conservative_import', 'encoding', 'skip_lines') + 'associated_group', 'conservative_import', 'encoding', 'skip_lines' + ) def __init__(self, *args, **kwargs): user = kwargs.pop('user') diff --git a/ishtar_common/static/media/styles.css b/ishtar_common/static/media/styles.css index aa0691409..453583bbe 100644 --- a/ishtar_common/static/media/styles.css +++ b/ishtar_common/static/media/styles.css @@ -161,6 +161,8 @@ table.dataTable thead th, table.dataTable thead td { .display_details{ font-size: 1.4em; + vertical-align: middle; + padding: 0 0.1em; } .progress-detail{ diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index d5d138bd2..c9dfde974 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -18,6 +18,7 @@ + diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index 12f630de7..7f7e97c5b 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -2,7 +2,7 @@

- {% if url_new %} @@ -145,7 +145,21 @@ jQuery(document).ready(function(){ return json.rows; } }, - "select": {% if multiple_select %}true{% else %}'single'{% endif %}, + "select": { + "style": {% if multiple_select %}'multi'{% else %}'single'{% endif %} + }, + {% if multiple_select %}"buttons": [ + 'selectAll', + 'selectNone' + ], + language: { + buttons: { + selectAll: "{% trans 'Select all items' %}", + selectNone: "{% trans 'Select none' %}" + } + }, + "dom": 'lBtip', + {% endif %} "columns": [ { "data": "id", "visible": false }, { "data": "link", "orderable": false },{% for col in extra_cols %} @@ -236,8 +250,6 @@ jQuery(document).ready(function(){ }); {% else %} jQuery("#submit_form").click(function (){ - var mygrid = jQuery("#grid_{{name}}"); - var data = datatable_{{sname}}.rows( { selected: true } ).data(); {% if multiple_select %} var value = ""; @@ -256,7 +268,6 @@ jQuery(document).ready(function(){ }); function get_next_table_id(c_id){ - // var mygrid = jQuery("#grid_{{name}}"); var has_current_id = false; ids = datatable_{{sname}}.column(0).data(); @@ -267,7 +278,6 @@ jQuery(document).ready(function(){ return false; } function get_previous_table_id(c_id){ - // var mygrid = jQuery("#grid_{{name}}"); var previous_id = 0; ids = datatable_{{sname}}.column(0).data(); diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html index ed0dc14e1..a4d772236 100644 --- a/ishtar_common/templates/blocks/bs_form_snippet.html +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -36,7 +36,7 @@

- diff --git a/ishtar_common/templates/ishtar/basket_list.html b/ishtar_common/templates/ishtar/basket_list.html index 011ed97a0..43236aeb0 100644 --- a/ishtar_common/templates/ishtar/basket_list.html +++ b/ishtar_common/templates/ishtar/basket_list.html @@ -1,10 +1,19 @@ {% load i18n %} - -{% for item in basket.items.all %} - - - {% endfor %} -
{{item.full_label}}{% trans "remove" %}
+

diff --git a/ishtar_common/templates/ishtar/manage_basket.html b/ishtar_common/templates/ishtar/manage_basket.html index 3292318ea..26dd75c4c 100644 --- a/ishtar_common/templates/ishtar/manage_basket.html +++ b/ishtar_common/templates/ishtar/manage_basket.html @@ -4,12 +4,15 @@

{{page_name}}{% trans ":"%} {{basket}}

{% csrf_token %}
-

- - {% trans 'Checking "Select all" only selects the current page.' %} -

-{{form}} - + + {{form}} +
+ +

{% trans "Basket content" %}

@@ -27,15 +30,20 @@