Skip to content

Commit

Permalink
Unify tag display view with that of release
Browse files Browse the repository at this point in the history
This patch makes Tag view look more similar to the one of
Release by making more template fragments reuse the same
markup.

Fixes: go-gitea#23221
  • Loading branch information
wiktor-k committed Mar 27, 2023
1 parent 52fbd92 commit e7c96f7
Showing 1 changed file with 18 additions and 36 deletions.
54 changes: 18 additions & 36 deletions templates/repo/release/list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<tr>
<td class="tag">
<h3 class="release-tag-name gt-mb-3">
<a class="gt-df gt-ac" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a>
<a class="gt-df gt-ac" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a>
</h3>
<div class="download gt-df gt-ac">
{{if $.Permission.CanRead $.UnitTypeCode}}
Expand Down Expand Up @@ -69,25 +69,35 @@
{{range $idx, $release := .Releases}}
<li class="ui grid">
<div class="ui four wide column meta gt-mt-2">
{{if .IsTag}}
{{if .CreatedUnix}}<span class="time">{{TimeSinceUnix .CreatedUnix $.locale}}</span>{{end}}
{{else}}
<a class="gt-df gt-ac gt-je muted" href="{{if not .Sha1}}#{{else}}{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "gt-mr-2"}}{{.TagName}}</a>
{{if .Sha1}}
<span class="commit">
<a class="gt-mono muted" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .Sha1}}</a>
</span>
{{template "repo/branch_dropdown" dict "root" $ "release" .}}
{{end}}
{{end}}
</div>
<div class="ui twelve wide column detail">
{{if .IsTag}}
<div class="gt-df gt-ac gt-sb gt-fw gt-mb-3">
<h4 class="release-list-title gt-df gt-ac">
<a class="gt-df gt-ac" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{svg "octicon-tag" 24 "gt-mr-3"}}{{.TagName}}</a>
<a href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{.Title}}</a>
{{if .IsDraft}}
<span class="ui yellow label gt-ml-3 gt-mt-1">{{$.locale.Tr "repo.release.draft"}}</span>
{{else if .IsPrerelease}}
<span class="ui orange label gt-ml-3 gt-mt-1">{{$.locale.Tr "repo.release.prerelease"}}</span>
{{else if not .IsTag}}
<span class="ui green label gt-ml-3 gt-mt-1">{{$.locale.Tr "repo.release.stable"}}</span>
{{end}}
</h4>
<div class="gt-df gt-ac">
{{if $.CanCreateRelease}}
<a class="muted gt-ml-3 gt-df gt-ac" data-tooltip-content="{{$.locale.Tr "repo.release.edit"}}" href="{{$.RepoLink}}/releases/edit/{{.TagName | PathEscapeSegments}}" rel="nofollow">
{{svg "octicon-pencil"}}
</a>
{{end}}
</div>
</div>
{{if .IsTag}}
<p class="text grey">
{{if gt .Publisher.ID 0}}
<span class="author">
Expand All @@ -104,35 +114,7 @@
{{end}}
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}{{if .Target}}...{{.Target | PathEscapeSegments}}{{end}}">{{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.locale.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
</p>
<div class="download">
{{if $.Permission.CanRead $.UnitTypeCode}}
<a class="gt-mono muted" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "gt-mr-2"}}{{ShortSha .Sha1}}</a>
{{if not $.DisableDownloadSourceArchives}}
<a class="archive-link muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;ZIP</a>
<a class="archive-link muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip"}}&nbsp;TAR.GZ</a>
{{end}}
{{end}}
</div>
{{else}}
<div class="gt-df gt-ac gt-sb gt-fw gt-mb-3">
<h4 class="release-list-title gt-df gt-ac">
<a href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{.Title}}</a>
{{if .IsDraft}}
<span class="ui yellow label gt-ml-3 gt-mt-1">{{$.locale.Tr "repo.release.draft"}}</span>
{{else if .IsPrerelease}}
<span class="ui orange label gt-ml-3 gt-mt-1">{{$.locale.Tr "repo.release.prerelease"}}</span>
{{else if not .IsTag}}
<span class="ui green label gt-ml-3 gt-mt-1">{{$.locale.Tr "repo.release.stable"}}</span>
{{end}}
</h4>
<div class="gt-df gt-ac">
{{if $.CanCreateRelease}}
<a class="muted gt-ml-3 gt-df gt-ac" data-tooltip-content="{{$.locale.Tr "repo.release.edit"}}" href="{{$.RepoLink}}/releases/edit/{{.TagName | PathEscapeSegments}}" rel="nofollow">
{{svg "octicon-pencil"}}
</a>
{{end}}
</div>
</div>
<p class="text grey">
<span class="author">
{{if .OriginalAuthor}}
Expand All @@ -154,6 +136,7 @@
| <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}...{{.Target | PathEscapeSegments}}">{{$.locale.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.locale.Tr "repo.release.ahead.target" .Target}}</span>
{{end}}
</p>
{{end}}
<div class="markup desc">
{{Str2html .Note}}
</div>
Expand Down Expand Up @@ -187,7 +170,6 @@
{{end}}
</ul>
</details>
{{end}}
<span class="dot">&nbsp;</span>
</div>
</li>
Expand Down

0 comments on commit e7c96f7

Please sign in to comment.