]> _ Git - cubist_cms-back.git/commitdiff
Preserve current admin tab when switching languages. Try #3349 @1
authorStephen Cameron <stephen@cubedesigners.com>
Thu, 16 Jan 2020 19:09:44 +0000 (20:09 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Thu, 16 Jan 2020 19:09:44 +0000 (20:09 +0100)
src/resources/views/edit.blade.php

index 1855b0b27fab691334bf8c7e3fe41fb6a577ca56..b00aea0ea4280e1e3eb7ddc602befc4ee7236283 100644 (file)
@@ -1,2 +1,18 @@
+@push('crud_fields_scripts')
+    <script>
+        jQuery(document).ready(function ($) {
+
+            // When clicking on a locale link in the dropdown menu, it doesn't preserve
+            // the current tab because this is stored in the hash and managed by JS.
+            // To overcome this, we catch the locale links and append the hash to them...
+            $(document).on('click', '.dropdown-menu a[href*="?locale="]', function(event) {
+                event.preventDefault();
+                window.location.href = $(this).attr('href') + document.location.hash;
+            });
+
+        });
+    </script>
+@endpush
+
 @include('cubist_back::when')
 @include('crud::edit')