mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-18 07:12:20 +00:00
a527f5a3e7
Fixes: https://github.com/go-gitea/gitea/issues/29438 This contains numerous enhancements for how large commit messages and large filenames render. Another notable change is that the file path is no longer cut off by backend at 30 chars, but rendered in full with wrapping. <img width="1329" alt="Screenshot 2024-04-09 at 21 53 57" src="https://github.com/go-gitea/gitea/assets/115237/5ccbb3d6-643a-4f60-ba79-3572b36d5182"> <hr> <img width="711" alt="Screenshot 2024-04-09 at 21 44 24" src="https://github.com/go-gitea/gitea/assets/115237/6ffe8fbb-407c-4aa7-b591-3d80daea7d57"> <hr> <img width="439" alt="Screenshot 2024-04-09 at 21 19 03" src="https://github.com/go-gitea/gitea/assets/115237/1ec7f6e9-2fd8-4841-87eb-6ca02ab9cd61"> <hr> <img width="444" alt="Screenshot 2024-04-09 at 21 18 52" src="https://github.com/go-gitea/gitea/assets/115237/70931b9e-5841-477e-b3bc-98f8d2662964"> --------- Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit 50099d7af436785daf66a3a9f27bd5c009f90684) Conflicts: - templates/repo/diff/box.tmpl Picked Gitea's version, because it appears we missed a gt-gap-1 => tw-gap-1 conversion - web_src/css/repo.css Conflict due to tag signature highlighting, resolved by adding the Gitea changes on top of ours manually.
73 lines
3.4 KiB
Go HTML Template
73 lines
3.4 KiB
Go HTML Template
<table id="repo-files-table" class="ui single line table tw-mt-0" {{if .HasFilesWithoutLatestCommit}}hx-indicator="tr.notready td.message span" hx-trigger="load" hx-swap="morph" hx-post="{{.LastCommitLoaderURL}}"{{end}}>
|
|
<thead>
|
|
<tr class="commit-list">
|
|
<th class="tw-overflow-hidden" colspan="2">
|
|
<div class="tw-flex">
|
|
<div class="latest-commit">
|
|
{{template "repo/latest_commit" .}}
|
|
</div>
|
|
</div>
|
|
</th>
|
|
<th class="text grey right age">{{if .LatestCommit}}{{if .LatestCommit.Committer}}{{TimeSince .LatestCommit.Committer.When ctx.Locale}}{{end}}{{end}}</th>
|
|
</tr>
|
|
</thead>
|
|
<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>
|
|
</tr>
|
|
{{end}}
|
|
{{range $item := .Files}}
|
|
{{$entry := $item.Entry}}
|
|
{{$commit := $item.Commit}}
|
|
{{$subModuleFile := $item.SubModuleFile}}
|
|
<tr data-entryname="{{$entry.Name}}" data-ready="{{if $commit}}true{{else}}false{{end}}" class="{{if not $commit}}not{{end}}ready entry">
|
|
<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 */}}
|
|
{{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>
|
|
{{else}}
|
|
{{$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}}
|
|
{{$subJumpablePathName}}
|
|
{{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>
|
|
{{end}}
|
|
{{end}}
|
|
</span>
|
|
</td>
|
|
<td class="message nine wide">
|
|
<span class="truncate">
|
|
{{if $commit}}
|
|
{{$commitLink := printf "%s/commit/%s" $.RepoLink (PathEscape $commit.ID.String)}}
|
|
{{RenderCommitMessageLinkSubject $.Context $commit.Message $commitLink ($.Repository.ComposeMetas ctx)}}
|
|
{{else}}
|
|
<div class="ui active tiny slow centered inline"></div>
|
|
{{end}}
|
|
</span>
|
|
</td>
|
|
<td class="text right age three wide">{{if $commit}}{{TimeSince $commit.Committer.When ctx.Locale}}{{end}}</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{if .ReadmeExist}}
|
|
{{template "repo/view_file" .}}
|
|
{{end}}
|