From 3adf7c73b6c1a78dfd2f64ed9639dd6730bce101 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 19 Oct 2021 22:38:52 +1100 Subject: [PATCH] Change select2 to 4.0.13 and fix autofocus. Other minor cosmetic fix --- app/Console/Commands/PacketInfo.php | 4 +++- public/plugin/select2/fix-autofocus.js | 8 ++++++++ resources/views/setup.blade.php | 5 +++-- resources/views/system/moveaddr.blade.php | 5 +++-- resources/views/zone/addedit.blade.php | 5 +++-- 5 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 public/plugin/select2/fix-autofocus.js diff --git a/app/Console/Commands/PacketInfo.php b/app/Console/Commands/PacketInfo.php index ca291a6..fdee03a 100644 --- a/app/Console/Commands/PacketInfo.php +++ b/app/Console/Commands/PacketInfo.php @@ -15,7 +15,9 @@ class PacketInfo extends Command * * @var string */ - protected $signature = 'packet:info {pkt : Packet to process} {zone? : Zone the packet is from}'; + protected $signature = 'packet:info' + .' {pkt : Packet to process}' + .' {zone? : Zone the packet is from}'; /** * The console command description. diff --git a/public/plugin/select2/fix-autofocus.js b/public/plugin/select2/fix-autofocus.js new file mode 100644 index 0000000..94b965c --- /dev/null +++ b/public/plugin/select2/fix-autofocus.js @@ -0,0 +1,8 @@ +$(document).on('select2:open',(event) => { + const searchField = document.querySelector( + `.select2-search__field[aria-controls="select2-${event.target.getAttribute('data-select2-id')}-results"]`, + ); + if (searchField) { + searchField.focus(); + } +}); diff --git a/resources/views/setup.blade.php b/resources/views/setup.blade.php index 36a7ab0..f15abad 100644 --- a/resources/views/setup.blade.php +++ b/resources/views/setup.blade.php @@ -198,10 +198,11 @@ use App\Models\Setup; @endsection @section('page-css') - + @append @section('page-scripts') - + + + + + +