mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-29 12:46:16 +01:00
Merge pull request 'feat(UI): add links to icons in repository file list' (#4648) from mahlzahn/forgejo:add_icon_links_file_list into forgejo
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/valkey/valkey:7.2.5-alpine3.19 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:ghcr.io/microsoft/garnet-alpine:1.0.14 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:redis:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:registry.redict.io/redict:7.3.0-scratch port:6379]) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/valkey/valkey:7.2.5-alpine3.19 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:ghcr.io/microsoft/garnet-alpine:1.0.14 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:redis:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:registry.redict.io/redict:7.3.0-scratch port:6379]) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4648 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
commit
9df2fbb187
2 changed files with 14 additions and 15 deletions
|
@ -14,7 +14,7 @@
|
|||
<tbody>
|
||||
{{if .HasParentPath}}
|
||||
<tr class="has-parent">
|
||||
<td colspan="3">{{svg "octicon-reply"}}<a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a></td>
|
||||
<td colspan="3"><a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">{{svg "octicon-reply" 16 "tw-mr-2"}}..</a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{range $item := .Files}}
|
||||
|
@ -25,30 +25,29 @@
|
|||
<td class="name four wide">
|
||||
<span class="truncate">
|
||||
{{if $entry.IsSubModule}}
|
||||
{{svg "octicon-file-submodule"}}
|
||||
{{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}}
|
||||
{{$icon := (svg "octicon-file-submodule" 16 "tw-mr-2")}}
|
||||
{{if $refURL}}
|
||||
<a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a>
|
||||
<a class="muted" href="{{$refURL}}">{{$icon}}{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a>
|
||||
{{else}}
|
||||
{{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}}
|
||||
{{$icon}}{{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{if $entry.IsDir}}
|
||||
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
|
||||
{{svg "octicon-file-directory-fill"}}
|
||||
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
|
||||
{{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
|
||||
{{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
|
||||
{{if eq $subJumpablePathFieldLast 0}}
|
||||
{{svg "octicon-file-directory-fill" 16 "tw-mr-2" -}}
|
||||
{{if eq $subJumpablePathFieldLast 0 -}}
|
||||
{{$subJumpablePathName}}
|
||||
{{else}}
|
||||
{{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}}
|
||||
{{else -}}
|
||||
{{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast -}}
|
||||
<span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}}
|
||||
{{end}}
|
||||
</a>
|
||||
{{else}}
|
||||
{{svg (printf "octicon-%s" (EntryIcon $entry))}}
|
||||
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
|
||||
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{svg (printf "octicon-%s" (EntryIcon $entry)) 16 "tw-mr-2"}}{{$entry.Name}}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</span>
|
||||
|
|
|
@ -181,11 +181,11 @@ func TestViewRepoWithSymlinks(t *testing.T) {
|
|||
return fmt.Sprintf("%s: %s", file, cls)
|
||||
})
|
||||
assert.Len(t, items, 5)
|
||||
assert.Equal(t, "a: svg octicon-file-directory-fill", items[0])
|
||||
assert.Equal(t, "link_b: svg octicon-file-directory-symlink", items[1])
|
||||
assert.Equal(t, "link_d: svg octicon-file-symlink-file", items[2])
|
||||
assert.Equal(t, "link_hi: svg octicon-file-symlink-file", items[3])
|
||||
assert.Equal(t, "link_link: svg octicon-file-symlink-file", items[4])
|
||||
assert.Equal(t, "a: tw-mr-2 svg octicon-file-directory-fill", items[0])
|
||||
assert.Equal(t, "link_b: tw-mr-2 svg octicon-file-directory-symlink", items[1])
|
||||
assert.Equal(t, "link_d: tw-mr-2 svg octicon-file-symlink-file", items[2])
|
||||
assert.Equal(t, "link_hi: tw-mr-2 svg octicon-file-symlink-file", items[3])
|
||||
assert.Equal(t, "link_link: tw-mr-2 svg octicon-file-symlink-file", items[4])
|
||||
}
|
||||
|
||||
// TestViewAsRepoAdmin tests PR #2167
|
||||
|
|
Loading…
Reference in a new issue