From 2aee992e9987ae891f314b66c1e98ffc5bb90596 Mon Sep 17 00:00:00 2001 From: Agus Mahasadhu Date: Wed, 23 Sep 2020 14:21:35 +0800 Subject: [PATCH] bugfix select on change, revert to previous value when user click cancel on confirmation box --- .../backpack/crud/fields/select_page_template.blade.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/resources/views/vendor/backpack/crud/fields/select_page_template.blade.php b/src/resources/views/vendor/backpack/crud/fields/select_page_template.blade.php index ad719d0..08a97d3 100644 --- a/src/resources/views/vendor/backpack/crud/fields/select_page_template.blade.php +++ b/src/resources/views/vendor/backpack/crud/fields/select_page_template.blade.php @@ -66,12 +66,15 @@ function strip_last_template_parameter(url) { } jQuery(document).ready(function($) { + $('#select_template').data('current', $('#select_template').val()); + $("#select_template").change(function(e) { var select_template_confirmation = confirm("@lang('backpack::pagemanager.change_template_confirmation')"); if (select_template_confirmation == true) { redirect_to_new_page_with_template_parameter(); } else { // txt = "You pressed Cancel!"; + $('#select_template').val($('#select_template').data('current')); } }); @@ -81,4 +84,4 @@ function strip_last_template_parameter(url) { @endif {{-- End of Extra CSS and JS --}} -{{-- ########################################## --}} \ No newline at end of file +{{-- ########################################## --}}