From 0ef4a10abef7fc58c9ab1db8060cf6eb2caca94a Mon Sep 17 00:00:00 2001 From: Brandon Lo Date: Wed, 3 Jul 2019 12:32:15 -0400 Subject: Redesign multiple select filter widget Removed the right border on the lab selection box so that it looks better on mobile, replaced with a rounded border around the content. Also fixed the button click bug where it wouldn't filter the images list. It now properly processes the selected host and disables images accordingly. Change-Id: I1dca1962a81e379f6ae3f7c006d6033bdd9f6ad8 Signed-off-by: Brandon Lo --- src/static/css/base.css | 3 --- src/templates/booking/quick_deploy.html | 26 ++++++++------------- .../dashboard/multiple_select_filter_widget.html | 27 ++++++++++++++-------- src/templates/resource/steps/define_hardware.html | 2 +- 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/static/css/base.css b/src/static/css/base.css index 1494e77..a2d5b05 100644 --- a/src/static/css/base.css +++ b/src/static/css/base.css @@ -66,9 +66,6 @@ a[aria-expanded="true"] > i.rotate { box-shadow: 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(109, 243, 76, 0.6); transition: border-color ease-in-out .1s,box-shadow ease-in-out .1s; } -#grid_wrapper > .row > div:first-child { - border-right: 1px solid gray; -} /* Cursor effects */ .not-allowed { diff --git a/src/templates/booking/quick_deploy.html b/src/templates/booking/quick_deploy.html index 50ec59a..6776980 100644 --- a/src/templates/booking/quick_deploy.html +++ b/src/templates/booking/quick_deploy.html @@ -7,13 +7,13 @@
{% csrf_token %}
-
-
-
-

Please select a host type you wish to book. Only available types are shown.

- {% bootstrap_field form.filter_field show_label=False %} -
+
+
+

Please select a host type you wish to book. Only available types are shown.

+ {% bootstrap_field form.filter_field show_label=False %}
+
+
{% bootstrap_field form.purpose %} @@ -80,11 +80,8 @@ var sup_installer_dict = {{installer_filter | safe}}; var sup_scenario_dict = {{scenario_filter | safe}}; - function imageHider() { + function imageFilter() { var drop = document.getElementById("id_image"); - - hide_dropdown("id_image"); - var lab_pk = get_selected_value("lab"); var host_pk = get_selected_value("host"); @@ -92,21 +89,18 @@ var image_object = sup_image_dict[childNode.value]; if (image_object) //weed out empty option { - if (image_object.host_profile == host_pk && image_object.lab == lab_pk) { - childNode.style.display = "inherit"; - childNode.disabled = false; - } + childNode.disabled = !(image_object.host_profile == host_pk && image_object.lab == lab_pk); } } } - imageHider(); + imageFilter(); $('#id_installer').children().hide(); $('#id_scenario').children().hide(); Array.from(document.getElementsByClassName("grid-item-select-btn")).forEach(function (element) { - element.addEventListener('click', imageHider); + element.addEventListener('click', imageFilter); }); function installerHider() { diff --git a/src/templates/dashboard/multiple_select_filter_widget.html b/src/templates/dashboard/multiple_select_filter_widget.html index 4a65bd9..4068919 100644 --- a/src/templates/dashboard/multiple_select_filter_widget.html +++ b/src/templates/dashboard/multiple_select_filter_widget.html @@ -2,17 +2,17 @@ -
-
- {% for object_class, object_list in display_objects %} -
+
+ {% for object_class, object_list in display_objects %} +
+

{{object_class}}

-
+
{% for obj in object_list %} -
-
+
+

{{obj.name}}

@@ -20,15 +20,22 @@

{{obj.description}}

{% endfor %}
- {% endfor %} -
+
+ {% endfor %}