|
3 | 3 | import Cookies from 'js-cookie/src/js.cookie'; |
4 | 4 |
|
5 | 5 | $(document).ready(() => { |
6 | | - |
7 | 6 | let currentUrl = window.location.href; |
8 | 7 |
|
9 | 8 | $('.sidebar .nav-item').each(function () { |
10 | 9 | let sidebarLink = $('a', this).attr('href'); |
11 | 10 | if (currentUrl.includes(sidebarLink)) { |
12 | 11 | $(this).addClass('active'); |
13 | | - } else if (sidebarLink.includes('locations') && currentUrl.includes('locations')) { |
| 12 | + } else if ( |
| 13 | + sidebarLink.includes('locations') && |
| 14 | + currentUrl.includes('locations') |
| 15 | + ) { |
14 | 16 | $(this).addClass('active'); |
15 | 17 | } |
16 | 18 | }); |
17 | 19 |
|
18 | 20 | // Toggle the side navigation |
19 | | - $("#sidebarToggle").on('click', (e) => { |
20 | | - |
| 21 | + $('#sidebarToggle').on('click', (e) => { |
21 | 22 | let $body = $('body'); |
22 | 23 | e.preventDefault(); |
23 | 24 |
|
24 | | - if ($($body).is(".sidebar-toggled")) { |
| 25 | + if ($($body).is('.sidebar-toggled')) { |
25 | 26 | Cookies.set('sidebar-toggled', false); |
26 | 27 | } else { |
27 | 28 | Cookies.set('sidebar-toggled', true); |
28 | 29 | } |
29 | 30 |
|
30 | | - $("body").toggleClass("sidebar-toggled"); |
31 | | - $(".sidebar").toggleClass("toggled"); |
| 31 | + $body.toggleClass('sidebar-toggled'); |
| 32 | + $('.sidebar').toggleClass('toggled'); |
32 | 33 | }); |
33 | 34 |
|
34 | 35 | // Sorting |
35 | 36 | $('#sort_by, #state').on('change', () => { |
36 | 37 | let value = $('#sort_by').val(); |
37 | 38 | let state = $('#state').val(); |
38 | | - window.location.href = window.location.pathname + '?sort_by=' + value + '&state=' + state; |
| 39 | + window.location.href = |
| 40 | + window.location.pathname + |
| 41 | + '?sort_by=' + |
| 42 | + value + |
| 43 | + '&state=' + |
| 44 | + state; |
39 | 45 | }); |
40 | | - |
41 | 46 | }); |
0 commit comments