Akron | 2d01d29 | 2018-11-23 11:17:35 +0100 | [diff] [blame] | 1 | % my $side_bar = content_block 'sidebar'; |
| 2 | |
Akron | 1d09b53 | 2021-06-15 18:18:25 +0200 | [diff] [blame] | 3 | % my $classes = ''; |
Uyen-Nhu Tran | 243fe73 | 2024-04-10 01:17:24 +0200 | [diff] [blame] | 4 | |
Akron | 1d09b53 | 2021-06-15 18:18:25 +0200 | [diff] [blame] | 5 | % if (length($side_bar) == 0) { |
| 6 | % if (my $nav = navigation('settings')) { |
| 7 | % $side_bar = b('<nav>' . $nav . '</nav>'); |
| 8 | % $classes = 'settings '; |
| 9 | % }; |
| 10 | % } |
| 11 | |
Uyen-Nhu Tran | 243fe73 | 2024-04-10 01:17:24 +0200 | [diff] [blame] | 12 | % my $is_empty_sidebar = $side_bar =~ /^\s*(<div[^>]*>\s*<\/div>\s*)*$/i; |
| 13 | |
| 14 | % if ($is_empty_sidebar) { |
| 15 | % $classes .= ' invisible'; |
| 16 | % }; |
| 17 | |
Akron | b01cccc | 2024-09-30 15:32:43 +0200 | [diff] [blame] | 18 | % if (length($side_bar) == 0 || stash('sidebar_off')) { |
Akron | 1d09b53 | 2021-06-15 18:18:25 +0200 | [diff] [blame] | 19 | % $classes .= ' off'; |
| 20 | % } elsif (stash('sidebar_active')) { |
| 21 | % $classes .= ' active'; |
Akron | dc0b3ab | 2021-06-18 11:52:43 +0200 | [diff] [blame] | 22 | % } elsif (stash('login_active') && !$classes) { |
Uyen-Nhu Tran | 243fe73 | 2024-04-10 01:17:24 +0200 | [diff] [blame] | 23 | % $classes .= ' invisible'; |
| 24 | % } elsif (!stash('login_active') && $side_bar =~ /<form.*class=".*login.*".*>/i) { |
| 25 | % $classes .= ' invisible'; |
Akron | 1d09b53 | 2021-06-15 18:18:25 +0200 | [diff] [blame] | 26 | % }; |
| 27 | |
Akron | 1d09b53 | 2021-06-15 18:18:25 +0200 | [diff] [blame] | 28 | <aside tabindex="0" class="<%= $classes %>"> |
Akron | e496844 | 2018-05-22 15:32:07 +0200 | [diff] [blame] | 29 | <div> |
Akron | 2d01d29 | 2018-11-23 11:17:35 +0100 | [diff] [blame] | 30 | %= $side_bar |
Akron | e496844 | 2018-05-22 15:32:07 +0200 | [diff] [blame] | 31 | </div> |
| 32 | </aside> |