Nice little directory browser :D
1@*
2 This file is part of Utatane.
3
4 Utatane is free software: you can redistribute it and/or modify it under
5 the terms of the GNU Affero General Public License as published by the Free
6 Software Foundation, either version 3 of the License, or (at your option)
7 any later version.
8
9 Utatane is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
12 more details.
13
14 You should have received a copy of the GNU Affero General Public License
15 along with Utatane. If not, see <http://www.gnu.org/licenses/>.
16*@
17
18<a id="go-back"
19 class="clickable"
20 href="@(_isAtRoot ? null : "..")"
21 aria-label="Go up 1 directory"
22 hx-boost="true"
23 aria-disabled="@(_isAtRoot ? "true" : "false")"
24 tabindex="@(_isAtRoot ? -1 : 0)"
25 onClick="@(_isAtRoot ? "event.preventDefault();" : null)"
26 @attributes="AdditionalAttributes"
27>
28 <span class="cursor-default! [vertical-align:sub]">../</span>
29</a>
30
31@code {
32 [Parameter]
33 public required String Path { get; set; }
34
35 [Parameter(CaptureUnmatchedValues = true)]
36 public IDictionary<String, Object>? AdditionalAttributes { get; set; }
37
38 private bool _isAtRoot;
39
40 protected override Task OnInitializedAsync() {
41 _isAtRoot = Path == "/";
42
43 return base.OnInitializedAsync();
44 }
45}