From c20c0f1fa45377c6ae119affd184184336d21bfd Mon Sep 17 00:00:00 2001 From: RyanTG Date: Tue, 24 Dec 2024 17:19:16 -0800 Subject: [PATCH] Quick patch to fix the x button not clearing out field values --- app/assets/stylesheets/application.scss.erb | 7 ++-- app/assets/stylesheets/mediaqueries.css | 1 - app/views/pages/map.html.haml | 36 +++++++++++++++------ 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/application.scss.erb b/app/assets/stylesheets/application.scss.erb index f5bf0d12..82ee30cb 100644 --- a/app/assets/stylesheets/application.scss.erb +++ b/app/assets/stylesheets/application.scss.erb @@ -1301,11 +1301,14 @@ span.or { .hide_search_link, .hide_button, -.single_hide, -span.single_hide { +#single_hide { display: none; } +#single_hide { + width: 100%; +} + span.single_hide { font-size: 12px; padding-left: 5px; diff --git a/app/assets/stylesheets/mediaqueries.css b/app/assets/stylesheets/mediaqueries.css index f60fb57b..fd635859 100644 --- a/app/assets/stylesheets/mediaqueries.css +++ b/app/assets/stylesheets/mediaqueries.css @@ -156,7 +156,6 @@ only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (or } span.single_hide { - /* font-size: 10px; */ width: 60px; } } diff --git a/app/views/pages/map.html.haml b/app/views/pages/map.html.haml index 64198eb5..c0f7e18e 100644 --- a/app/views/pages/map.html.haml +++ b/app/views/pages/map.html.haml @@ -19,8 +19,9 @@ = text_field_tag "by_machine_name", params["by_machine_name"], class: 'lookup_search_input', placeholder: @machine_placeholder, clear_id: 'clearButton' #clearButton{input_id: "by_machine_name"} X - %input{:type => "checkbox", :id => "singleVersion", :name => "singleVersion", :class => "m_0 single_hide"} - %span.single_hide Exact machine version? + #single_hide + %input{:type => "checkbox", :id => "singleVersion", :name => "singleVersion", :class => "m_0 single_hide"} + %span.single_hide Exact machine version? .map_input %span.input_title Near = text_field_tag "address", params[:address], class: 'lookup_search_input', placeholder: @big_cities_placeholder, clear_id: 'clearButton2' @@ -106,8 +107,25 @@ inputField.value = ""; event.target.style.display = "none"; } - clearButton.addEventListener("click", clear); - clearButton2.addEventListener("click", clear); + function clearMachine(event) { + document.getElementById('by_machine_id').value = ""; + document.getElementById('by_machine_name').value = ""; + document.getElementById('by_machine_single_id').value = ""; + document.getElementById('by_machine_group_id').value = ""; + document.getElementById('single_hide').style.display = "none"; + document.getElementById('singleVersion').checked = false; + single_id = ''; + event.target.style.display = "none"; + } + function clearLocation(event) { + document.getElementById('address').value = ""; + document.getElementById('by_city_name').value = ""; + document.getElementById('by_state_name').value = ""; + event.target.style.display = "none"; + } + + clearButton.addEventListener("click", clearMachine); + clearButton2.addEventListener("click", clearLocation); clearButton3.addEventListener("click", clear); $(function () { @@ -120,7 +138,7 @@ $('#by_machine_group_id').val(''); $('#by_at_least_n_machines').val(''); $('#by_type_id').val(''); - $('.single_hide').hide(); + $('#single_hide').hide(); $('#singleVersion').prop('checked', false); single_id = ''; }); @@ -134,7 +152,7 @@ $('#by_machine_name').val(''); $('#by_machine_single_id').val(''); $('#by_machine_group_id').val(''); - $('.single_hide').hide(); + $('#single_hide').hide(); $('#singleVersion').prop('checked', false); single_id = ''; } @@ -159,7 +177,7 @@ $('#by_machine_group_id').val(''); $('#by_location_id').val(ui.item.id); $('#by_location_name').val(ui.item.value); - $('.single_hide').hide(); + $('#single_hide').hide(); $('#singleVersion').prop('checked', false); single_id = ''; }); @@ -179,9 +197,9 @@ $('#by_machine_group_id').val(ui.item.group_id); single_id = $('#by_machine_single_id').val(); if ($('#by_machine_group_id').val().length != 0) { - $('.single_hide').show(); + document.getElementById('single_hide').style.display = "flex"; } else { - $('.single_hide').hide(); + $('#single_hide').hide(); $('#singleVersion').prop('checked', false); } });