From 48e42996ef463ca03664fbeafa047b1338998686 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Mon, 10 Jun 2019 09:10:12 -0400 Subject: Fix searchable select field scaling Change-Id: Id6fb052b2158ee0db30fd11b520194d3825b677f Signed-off-by: Sawyer Bergeron --- src/templates/booking/quick_deploy.html | 5 + .../dashboard/searchable_select_multiple.html | 125 +++++++++++++++------ 2 files changed, 97 insertions(+), 33 deletions(-) (limited to 'src/templates') diff --git a/src/templates/booking/quick_deploy.html b/src/templates/booking/quick_deploy.html index 07794bc..f0a2bc1 100644 --- a/src/templates/booking/quick_deploy.html +++ b/src/templates/booking/quick_deploy.html @@ -31,9 +31,14 @@ border: none; box-shadow: none; } + input[type=range]::-moz-range-track { background: #cccccc; } + + .grid_element { + overflow: hidden; + } {% bootstrap_form_errors form type='non_fields' %}
diff --git a/src/templates/dashboard/searchable_select_multiple.html b/src/templates/dashboard/searchable_select_multiple.html index 69394ab..588b693 100644 --- a/src/templates/dashboard/searchable_select_multiple.html +++ b/src/templates/dashboard/searchable_select_multiple.html @@ -1,6 +1,6 @@ -
+
{% if incompatible == "true" %}

Warning: Incompatible Configuration

@@ -22,12 +22,13 @@
-

0

/ - {% if selectable_limit > -1 %} {{ selectable_limit }} {% else %} ∞ {% endif %}added

+
+

0

+

/ {% if selectable_limit > -1 %} {{ selectable_limit }} {% else %} ∞ {% endif %}added

+
@@ -295,6 +347,14 @@ return results; } + function generate_element_text(obj) + { + var content_strings = [obj['expanded_name'], obj['small_name'], obj['string']].filter(x => Boolean(x)); + var result = content_strings.shift(); + if( result == null || content_strings.length < 1) return result; + return result + " (" + content_strings.join(", ") + ")"; + } + function dropdown(ids) { /* @@ -312,9 +372,14 @@ var result_entry = document.createElement("li"); var result_button = document.createElement("a"); var obj = items[id]; - var result_text = document.createTextNode(obj['small_name'] + " : " + obj['expanded_name']); - result_button.appendChild(result_text); + var result_text = generate_element_text(obj); + result_button.appendChild(document.createTextNode(result_text)); result_button.setAttribute('onclick', 'select_item("' + obj['id'] + '")'); + var tooltip = document.createElement("span"); + var tooltiptext = document.createTextNode(result_text); + tooltip.appendChild(tooltiptext); + tooltip.setAttribute('class', 'entry_tooltip'); + result_button.appendChild(tooltip); result_entry.appendChild(result_button); drop.appendChild(result_entry); } @@ -325,7 +390,7 @@ } else { - drop.style.display = 'inherit'; + drop.style.display = 'block'; } } @@ -377,11 +442,13 @@ item_id = added_items[key]; item = items[item_id]; - list_html += '

' - + item["expanded_name"] - + '

, ' - + item["small_name"] - + '

'; list_html += '
'; @@ -391,11 +458,3 @@ } - -- cgit 1.2.3-korg