summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2021-05-06 11:12:50 +0800
committerGitHub <noreply@github.com>2021-05-06 05:12:50 +0200
commit308886653148d859080222ebb72966e020f9391e (patch)
treef61bd23f73eee6a30cf28c477bf0d1c859b8aace /templates
parenteedc0c8324820817f4c06603ec3195a1d3513542 (diff)
downloadgitea-308886653148d859080222ebb72966e020f9391e.tar.gz
gitea-308886653148d859080222ebb72966e020f9391e.zip
fix some ui bug about draft release (#15137)
* fix some ui bug about draft release - should not show draft release in tag list because it will't create real tag - still show draft release without tag and commit message for draft release instead of 404 error - remove tag load for attachement links because it's useless Signed-off-by: a1012112796 <1012112796@qq.com> * add test code * fix test That's because has added a new release in relaese test database. * fix dropdown link for draft release
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/branch_dropdown.tmpl2
-rw-r--r--templates/repo/release/list.tmpl18
2 files changed, 12 insertions, 8 deletions
diff --git a/templates/repo/branch_dropdown.tmpl b/templates/repo/branch_dropdown.tmpl
index 3fd461c64f..9ddadeb3da 100644
--- a/templates/repo/branch_dropdown.tmpl
+++ b/templates/repo/branch_dropdown.tmpl
@@ -22,7 +22,7 @@
{{end}}
{{range .root.Tags}}
{{if $release}}
- <div class="item tag {{if eq $release.TagName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/compare/{{EscapePound .}}...{{if $release.TagName}}{{EscapePound $release.TagName}}{{else}}{{EscapePound $release.Sha1}}{{end}}">{{.}}</div>
+ <div class="item tag {{if eq $release.TagName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/compare/{{EscapePound .}}...{{if $release.IsDraft}}{{EscapePound $release.Target}}{{else}}}{{if $release.TagName}}{{EscapePound $release.TagName}}{{else}}{{EscapePound $release.Sha1}}{{end}}{{end}}">{{.}}</div>
{{else}}
<div class="item tag {{if eq $.root.BranchName .}}selected{{end}}" data-url="{{$.root.RepoLink}}/{{if $.root.PageIsCommits}}commits{{else}}src{{end}}/tag/{{EscapePound .}}{{if $.root.TreePath}}/{{EscapePound $.root.TreePath}}{{end}}">{{.}}</div>
{{end}}
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 6829e3e8e2..63f9e26cf1 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -75,11 +75,13 @@
<span class="ui green label">{{$.i18n.Tr "repo.release.stable"}}</span>
{{end}}
<span class="tag text blue">
- <a class="df ac je" href="{{$.RepoLink}}/src/tag/{{.TagName | EscapePound}}" rel="nofollow">{{svg "octicon-tag" 16 "mr-2"}}{{.TagName}}</a>
- </span>
- <span class="commit">
- <a class="mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Sha1}}</a>
+ <a class="df ac je" href="{{if .IsDraft}}#{{else}}{{$.RepoLink}}/src/tag/{{.TagName | EscapePound}}{{end}}" rel="nofollow">{{svg "octicon-tag" 16 "mr-2"}}{{.TagName}}</a>
</span>
+ {{if not .IsDraft}}
+ <span class="commit">
+ <a class="mono" href="{{$.RepoLink}}/src/commit/{{.Sha1}}" rel="nofollow">{{svg "octicon-git-commit" 16 "mr-2"}}{{ShortSha .Sha1}}</a>
+ </span>
+ {{end}}
{{template "repo/branch_dropdown" dict "root" $ "release" .}}
{{end}}
</div>
@@ -128,9 +130,11 @@
{{$.i18n.Tr "repo.released_this"}}
</span>
{{if .CreatedUnix}}
- <span class="time">{{TimeSinceUnix .CreatedUnix $.Lang}}</span> |
+ <span class="time">{{TimeSinceUnix .CreatedUnix $.Lang}}</span>
+ {{end}}
+ {{if not .IsDraft}}
+ | <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | EscapePound}}...{{.Target}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" .Target}}</span>
{{end}}
- <span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | EscapePound}}...{{.Target}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" .Target}}</span>
</p>
<div class="markdown desc">
{{Str2html .Note}}
@@ -142,7 +146,7 @@
</h2>
<div class="content {{if eq $idx 0}}active{{end}}">
<ul class="list">
- {{if $.Permission.CanRead $.UnitTypeCode}}
+ {{if and (not .IsDraft) ($.Permission.CanRead $.UnitTypeCode)}}
<li>
<a class="archive-link" data-url="{{$.RepoLink}}/archive/{{.TagName | EscapePound}}.zip" rel="nofollow"><strong>{{svg "octicon-file-zip" 16 "mr-2"}}{{$.i18n.Tr "repo.release.source_code"}} (ZIP)</strong></a>
</li>