loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'feat(UI): add links to icons in repository file list' (#4648) from mahlzahn/forgejo:add_icon_links_file_list into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4648
Reviewed-by: Gusted <gusted@noreply.codeberg.org>

+14 -15
+9 -10
templates/repo/view_list.tmpl
··· 14 14 <tbody> 15 15 {{if .HasParentPath}} 16 16 <tr class="has-parent"> 17 - <td colspan="3">{{svg "octicon-reply"}}<a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a></td> 17 + <td colspan="3"><a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">{{svg "octicon-reply" 16 "tw-mr-2"}}..</a></td> 18 18 </tr> 19 19 {{end}} 20 20 {{range $item := .Files}} ··· 25 25 <td class="name four wide"> 26 26 <span class="truncate"> 27 27 {{if $entry.IsSubModule}} 28 - {{svg "octicon-file-submodule"}} 29 28 {{$refURL := $subModuleFile.RefURL AppUrl $.Repository.FullName $.SSHDomain}} {{/* FIXME: the usage of AppUrl seems incorrect, it would be fixed in the future, use AppSubUrl instead */}} 29 + {{$icon := (svg "octicon-file-submodule" 16 "tw-mr-2")}} 30 30 {{if $refURL}} 31 - <a class="muted" href="{{$refURL}}">{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a> 31 + <a class="muted" href="{{$refURL}}">{{$icon}}{{$entry.Name}}</a><span class="at">@</span><a href="{{$refURL}}/commit/{{PathEscape $subModuleFile.RefID}}">{{ShortSha $subModuleFile.RefID}}</a> 32 32 {{else}} 33 - {{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}} 33 + {{$icon}}{{$entry.Name}}<span class="at">@</span>{{ShortSha $subModuleFile.RefID}} 34 34 {{end}} 35 35 {{else}} 36 36 {{if $entry.IsDir}} 37 37 {{$subJumpablePathName := $entry.GetSubJumpablePathName}} 38 - {{svg "octicon-file-directory-fill"}} 39 38 <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}"> 40 39 {{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}} 41 40 {{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}} 42 - {{if eq $subJumpablePathFieldLast 0}} 41 + {{svg "octicon-file-directory-fill" 16 "tw-mr-2" -}} 42 + {{if eq $subJumpablePathFieldLast 0 -}} 43 43 {{$subJumpablePathName}} 44 - {{else}} 45 - {{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast}} 44 + {{else -}} 45 + {{$subJumpablePathPrefixes := slice $subJumpablePathFields 0 $subJumpablePathFieldLast -}} 46 46 <span class="text light-2">{{StringUtils.Join $subJumpablePathPrefixes "/"}}</span>/{{index $subJumpablePathFields $subJumpablePathFieldLast}} 47 47 {{end}} 48 48 </a> 49 49 {{else}} 50 - {{svg (printf "octicon-%s" (EntryIcon $entry))}} 51 - <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a> 50 + <a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{svg (printf "octicon-%s" (EntryIcon $entry)) 16 "tw-mr-2"}}{{$entry.Name}}</a> 52 51 {{end}} 53 52 {{end}} 54 53 </span>
+5 -5
tests/integration/repo_test.go
··· 181 181 return fmt.Sprintf("%s: %s", file, cls) 182 182 }) 183 183 assert.Len(t, items, 5) 184 - assert.Equal(t, "a: svg octicon-file-directory-fill", items[0]) 185 - assert.Equal(t, "link_b: svg octicon-file-directory-symlink", items[1]) 186 - assert.Equal(t, "link_d: svg octicon-file-symlink-file", items[2]) 187 - assert.Equal(t, "link_hi: svg octicon-file-symlink-file", items[3]) 188 - assert.Equal(t, "link_link: svg octicon-file-symlink-file", items[4]) 184 + assert.Equal(t, "a: tw-mr-2 svg octicon-file-directory-fill", items[0]) 185 + assert.Equal(t, "link_b: tw-mr-2 svg octicon-file-directory-symlink", items[1]) 186 + assert.Equal(t, "link_d: tw-mr-2 svg octicon-file-symlink-file", items[2]) 187 + assert.Equal(t, "link_hi: tw-mr-2 svg octicon-file-symlink-file", items[3]) 188 + assert.Equal(t, "link_link: tw-mr-2 svg octicon-file-symlink-file", items[4]) 189 189 } 190 190 191 191 // TestViewAsRepoAdmin tests PR #2167