diff options
-rw-r--r-- | routers/web/repo/release.go | 26 | ||||
-rw-r--r-- | routers/web/web.go | 10 | ||||
-rw-r--r-- | templates/repo/release/list.tmpl | 69 | ||||
-rw-r--r-- | templates/repo/sub_menu.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/sub_menu_release_tag.tmpl | 17 | ||||
-rw-r--r-- | templates/repo/tag/list.tmpl | 85 | ||||
-rw-r--r-- | web_src/css/index.css | 1 | ||||
-rw-r--r-- | web_src/css/repository-release-tag.css | 151 | ||||
-rw-r--r-- | web_src/css/repository.css | 151 |
9 files changed, 281 insertions, 231 deletions
diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 6a5ebd5dad..689994c146 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -29,8 +29,9 @@ import ( ) const ( - tplReleases base.TplName = "repo/release/list" - tplReleaseNew base.TplName = "repo/release/new" + tplReleasesList base.TplName = "repo/release/list" + tplReleaseNew base.TplName = "repo/release/new" + tplTagsList base.TplName = "repo/tag/list" ) // calReleaseNumCommitsBehind calculates given release has how many commits behind release target. @@ -58,16 +59,19 @@ func calReleaseNumCommitsBehind(repoCtx *context.Repository, release *repo_model // Releases render releases list page func Releases(ctx *context.Context) { + ctx.Data["PageIsReleaseList"] = true + ctx.Data["Title"] = ctx.Tr("repo.release.releases") releasesOrTags(ctx, false) } // TagsList render tags list page func TagsList(ctx *context.Context) { + ctx.Data["PageIsTagList"] = true + ctx.Data["Title"] = ctx.Tr("repo.release.tags") releasesOrTags(ctx, true) } func releasesOrTags(ctx *context.Context, isTagList bool) { - ctx.Data["PageIsReleaseList"] = true ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch ctx.Data["IsViewBranch"] = false ctx.Data["IsViewTag"] = true @@ -75,14 +79,6 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { ctx.Data["CanCreateBranch"] = false ctx.Data["HideBranchesInDropdown"] = true - if isTagList { - ctx.Data["Title"] = ctx.Tr("repo.release.tags") - ctx.Data["PageIsTagList"] = true - } else { - ctx.Data["Title"] = ctx.Tr("repo.release.releases") - ctx.Data["PageIsTagList"] = false - } - listOptions := db.ListOptions{ Page: ctx.FormInt("page"), PageSize: ctx.FormInt("limit"), @@ -196,7 +192,11 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { pager.SetDefaultParams(ctx) ctx.Data["Page"] = pager - ctx.HTML(http.StatusOK, tplReleases) + if isTagList { + ctx.HTML(http.StatusOK, tplTagsList) + } else { + ctx.HTML(http.StatusOK, tplReleasesList) + } } // ReleasesFeedRSS get feeds for releases in RSS format @@ -282,7 +282,7 @@ func SingleRelease(ctx *context.Context) { } ctx.Data["Releases"] = []*repo_model.Release{release} - ctx.HTML(http.StatusOK, tplReleases) + ctx.HTML(http.StatusOK, tplReleasesList) } // LatestRelease redirects to the latest release diff --git a/routers/web/web.go b/routers/web/web.go index f7f32734d8..9d1bd90d93 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1198,7 +1198,7 @@ func RegisterRoutes(m *web.Route) { }, context.RepoMustNotBeArchived(), reqRepoCodeWriter, repo.MustBeNotEmpty) }, reqSignIn, context.RepoAssignment, context.UnitTypes()) - // Releases + // Tags m.Group("/{username}/{reponame}", func() { m.Group("/tags", func() { m.Get("", repo.TagsList) @@ -1207,6 +1207,12 @@ func RegisterRoutes(m *web.Route) { }, func(ctx *context.Context) { ctx.Data["EnableFeed"] = setting.Other.EnableFeed }, repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true)) + m.Post("/tags/delete", repo.DeleteTag, reqSignIn, + repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoCodeWriter, context.RepoRef()) + }, reqSignIn, context.RepoAssignment, context.UnitTypes()) + + // Releases + m.Group("/{username}/{reponame}", func() { m.Group("/releases", func() { m.Get("/", repo.Releases) m.Get("/tag/*", repo.SingleRelease) @@ -1224,8 +1230,6 @@ func RegisterRoutes(m *web.Route) { m.Post("/attachments", repo.UploadReleaseAttachment) m.Post("/attachments/remove", repo.DeleteAttachment) }, reqSignIn, repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoReleaseWriter, context.RepoRef()) - m.Post("/tags/delete", repo.DeleteTag, reqSignIn, - repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoCodeWriter, context.RepoRef()) m.Group("/releases", func() { m.Get("/edit/*", repo.EditRelease) m.Post("/edit/*", web.Bind(forms.EditReleaseForm{}), repo.EditReleasePost) diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index d0e3b9cc07..3d596a49e2 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -1,73 +1,16 @@ {{template "base/head" .}} -<div role="main" aria-label="{{.Title}}" class="page-content repository release"> +<div role="main" aria-label="{{.Title}}" class="page-content repository releases"> {{template "repo/header" .}} <div class="ui container"> {{template "base/alert" .}} - <h2 class="ui compact small menu header"> - {{if .Permission.CanRead $.UnitTypeReleases}} - <a class="{{if (and (not .PageIsSingleTag) (not .PageIsTagList))}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a> - {{end}} - {{if .Permission.CanRead $.UnitTypeCode}} - <a class="{{if (or .PageIsSingleTag .PageIsTagList)}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a> - {{end}} - </h2> - {{if .EnableFeed}} - <a href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss"><i class="ui grey icon gt-ml-3" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a> - {{end}} - {{if (and .CanCreateRelease (not .PageIsTagList))}} + {{template "repo/sub_menu_release_tag" .}} + + {{if .CanCreateRelease}} <a class="ui right small green button" href="{{$.RepoLink}}/releases/new"> {{.locale.Tr "repo.release.new_release"}} </a> {{end}} - {{if .PageIsTagList}} - <div class="ui divider"></div> - {{if gt .ReleasesNum 0}} - <h4 class="ui top attached header"> - <div class="five wide column gt-df gt-ac"> - {{svg "octicon-tag" 16 "gt-mr-2"}}{{.locale.Tr "repo.release.tags"}} - </div> - </h4> - <div class="ui attached table segment"> - <table class="ui very basic striped fixed table single line" id="tags-table"> - <thead></thead> - <tbody class="tag-list"> - {{range $idx, $release := .Releases}} - <tr> - <td class="tag"> - <h3 class="release-tag-name gt-mb-3"> - <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}} - {{if .CreatedUnix}} - <span class="gt-mr-3">{{svg "octicon-clock" 16 "gt-mr-2"}}{{TimeSinceUnix .CreatedUnix $.locale}}</span> - {{end}} - <a class="gt-mr-3 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 gt-mr-3 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-2"}}ZIP</a> - <a class="archive-link gt-mr-3 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-2"}}TAR.GZ</a> - {{end}} - {{if (and $.CanCreateRelease $release.IsTag)}} - <a class="gt-mr-3 muted" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.new_release"}}</a> - {{end}} - {{if (and ($.Permission.CanWrite $.UnitTypeCode) $release.IsTag)}} - <a class="ui delete-button gt-mr-3 muted" data-url="{{$.RepoLink}}/tags/delete" data-id="{{.ID}}"> - {{svg "octicon-trash" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.delete_tag"}} - </a> - {{end}} - {{if (not $release.IsTag)}} - <a class="gt-mr-3 muted" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.detail"}}</a> - {{end}} - {{end}} - </div> - </td> - </tr> - {{end}} - </tbody> - </table> - </div> - {{end}} - {{else}} + <ul id="release-list"> {{range $idx, $release := .Releases}} <li class="ui grid"> @@ -178,7 +121,7 @@ </li> {{end}} </ul> - {{end}} + {{template "base/paginate" .}} </div> </div> diff --git a/templates/repo/sub_menu.tmpl b/templates/repo/sub_menu.tmpl index 9289295b1d..2be7d47a1c 100644 --- a/templates/repo/sub_menu.tmpl +++ b/templates/repo/sub_menu.tmpl @@ -10,7 +10,7 @@ <a href="{{.RepoLink}}/branches">{{svg "octicon-git-branch"}} <b>{{.BranchesCount}}</b> {{.locale.TrN .BranchesCount "repo.branch" "repo.branches"}}</a> </div> {{if $.Permission.CanRead $.UnitTypeCode}} - <div class="item"> + <div class="item{{if .PageIsTagList}} active{{end}}"> <a href="{{.RepoLink}}/tags">{{svg "octicon-tag"}} <b>{{.NumTags}}</b> {{.locale.TrN .NumTags "repo.tag" "repo.tags"}}</a> </div> {{end}} diff --git a/templates/repo/sub_menu_release_tag.tmpl b/templates/repo/sub_menu_release_tag.tmpl new file mode 100644 index 0000000000..9e95c3c920 --- /dev/null +++ b/templates/repo/sub_menu_release_tag.tmpl @@ -0,0 +1,17 @@ +{{$canReadReleases := $.Permission.CanRead $.UnitTypeReleases}} +{{$canReadCode := $.Permission.CanRead $.UnitTypeCode}} + +{{if $canReadReleases}} + <h2 class="ui compact small menu header"> + <a class="{{if .PageIsReleaseList}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a> + {{if $canReadCode}} + <a class="{{if .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a> + {{end}} + </h2> + + {{if .EnableFeed}} + <a href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss"><i class="ui grey icon gt-ml-3" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a> + {{end}} +{{else if $canReadCode}} + {{template "repo/sub_menu" .}} +{{end}} diff --git a/templates/repo/tag/list.tmpl b/templates/repo/tag/list.tmpl new file mode 100644 index 0000000000..6f9e1e8d7a --- /dev/null +++ b/templates/repo/tag/list.tmpl @@ -0,0 +1,85 @@ +{{template "base/head" .}} + +<div role="main" aria-label="{{.Title}}" class="page-content repository tags"> + {{template "repo/header" .}} + <div class="ui container"> + {{template "base/alert" .}} + {{template "repo/sub_menu_release_tag" .}} + + <div class="ui divider"></div> + + <h4 class="ui top attached header"> + <div class="five wide column gt-df gt-ac"> + {{svg "octicon-tag" 16 "gt-mr-2"}}{{.locale.Tr "repo.release.tags"}} + </div> + </h4> + + {{$canReadReleases := $.Permission.CanRead $.UnitTypeReleases}} + + <div class="ui attached table segment"> + <table class="ui very basic striped fixed table single line" id="tags-table"> + <tbody class="tag-list"> + {{range $idx, $release := .Releases}} + <tr> + <td class="tag"> + <h3 class="release-tag-name gt-mb-3"> + {{if $canReadReleases}} + <a class="gt-df gt-ac" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{else}} + <a class="gt-df gt-ac" href="{{$.RepoLink}}/src/tag/{{.TagName | PathEscapeSegments}}" rel="nofollow">{{.TagName}}</a> + {{end}} + </h3> + <div class="download gt-df gt-ac"> + {{if $.Permission.CanRead $.UnitTypeCode}} + {{if .CreatedUnix}} + <span class="gt-mr-3">{{svg "octicon-clock" 16 "gt-mr-2"}}{{TimeSinceUnix .CreatedUnix $.locale}}</span> + {{end}} + + <a class="gt-mr-3 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 gt-mr-3 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-2"}}ZIP</a> + <a class="archive-link gt-mr-3 muted" href="{{$.RepoLink}}/archive/{{.TagName | PathEscapeSegments}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-2"}}TAR.GZ</a> + {{end}} + + {{if (and $canReadReleases $.CanCreateRelease $release.IsTag)}} + <a class="gt-mr-3 muted" href="{{$.RepoLink}}/releases/new?tag={{.TagName}}">{{svg "octicon-tag" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.new_release"}}</a> + {{end}} + + {{if (and ($.Permission.CanWrite $.UnitTypeCode) $release.IsTag)}} + <a class="ui delete-button gt-mr-3 muted" data-url="{{$.RepoLink}}/tags/delete" data-id="{{.ID}}"> + {{svg "octicon-trash" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.delete_tag"}} + </a> + {{end}} + + {{if and $canReadReleases (not $release.IsTag)}} + <a class="gt-mr-3 muted" href="{{$.RepoLink}}/releases/tag/{{.TagName | PathEscapeSegments}}">{{svg "octicon-tag" 16 "gt-mr-2"}}{{$.locale.Tr "repo.release.detail"}}</a> + {{end}} + {{end}} + </div> + </td> + </tr> + {{end}} + </tbody> + </table> + </div> + + {{template "base/paginate" .}} + </div> +</div> + +{{if $.Permission.CanWrite $.UnitTypeCode}} +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{.locale.Tr "repo.release.delete_tag"}} + </div> + <div class="content"> + <p>{{.locale.Tr "repo.release.deletion_tag_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> +{{end}} + + +{{template "base/footer" .}} diff --git a/web_src/css/index.css b/web_src/css/index.css index 8282511804..e59f3eb02a 100644 --- a/web_src/css/index.css +++ b/web_src/css/index.css @@ -30,6 +30,7 @@ @import "./install.css"; @import "./form.css"; @import "./repository.css"; +@import "./repository-release-tag.css"; @import "./editor.css"; @import "./editor-markdown.css"; @import "./organization.css"; diff --git a/web_src/css/repository-release-tag.css b/web_src/css/repository-release-tag.css new file mode 100644 index 0000000000..6922ce5179 --- /dev/null +++ b/web_src/css/repository-release-tag.css @@ -0,0 +1,151 @@ +.repository.releases #release-list { + border-top: 1px solid var(--color-secondary); + margin-top: 20px; + padding-top: 15px; + padding-left: 0; +} + +.repository.releases #release-list .release-list-title { + font-size: 2rem; + font-weight: normal; + margin-top: -4px; + margin-bottom: 0; +} + +.repository.releases #release-list > li { + list-style: none; +} + +.repository.releases #release-list > li .meta, +.repository.releases #release-list > li .detail { + padding-top: 30px; + padding-bottom: 40px; +} + +.repository.releases #release-list > li .meta { + text-align: right; + position: relative; +} + +.repository.releases #release-list > li .meta .label { + margin-right: 0; +} + +.repository.releases #release-list > li .meta .commit { + display: block; + margin-top: 10px; +} + +.repository.releases #release-list > li .meta .choose { + margin-top: 15px; +} + +.repository.releases #release-list > li .meta .choose .button { + margin-right: 0; +} + +.repository.releases #release-list > li .detail { + border-left: 2px solid var(--color-secondary); +} + +.repository.releases #release-list > li .detail .author img { + margin-bottom: 3px; +} + +.repository.releases #release-list > li .detail .download > a .svg { + margin-left: 5px; + margin-right: 5px; +} + +.repository.releases #release-list > li .detail .download .list { + padding-left: 0; +} + +.repository.releases #release-list > li .detail .download .list li { + list-style: none; + display: block; + padding: 8px; + border: 1px solid var(--color-secondary); + background: var(--color-light); +} + +.repository.releases #release-list > li .detail .download .list li a > .text.right { + margin-right: 5px; +} + +.repository.releases #release-list > li .detail .download .list li + li { + border-top: 0; +} + +.repository.releases #release-list > li .detail .download .list li:first-of-type { + border-radius: var(--border-radius) 0 0 var(--border-radius); +} + +.repository.releases #release-list > li .detail .download .list li:last-of-type { + border-radius: 0 var(--border-radius) var(--border-radius) 0; +} + +.repository.releases #release-list > li .detail .dot { + width: 10px; + height: 10px; + background-color: var(--color-secondary-dark-3); + z-index: 9; + position: absolute; + display: block; + left: -6px; + top: 40px; + border-radius: 100%; + border: 2.5px solid var(--color-body); +} + +.repository.tags #tags-table .tag { + padding: 8px 12px; +} + +.repository.tags #tags-table .release-tag-name { + font-size: 18px; + font-weight: normal; +} + +.repository.new.release .target { + min-width: 500px; +} + +.repository.new.release .target #tag-name { + margin-top: -4px; +} + +.repository.new.release .target .at { + margin-left: -5px; + margin-right: 5px; +} + +.repository.new.release .target .selection.dropdown { + padding-top: 10px; + padding-bottom: 10px; +} + +.repository.new.release .prerelease.field { + margin-bottom: 0; +} + +@media (max-width: 438px) { + .repository.new.release .field button, + .repository.new.release .field input { + width: 100%; + } +} + +@media (max-width: 767px) { + .repository.new.release .field button { + margin-bottom: 1em; + } +} + +.repository.new.release .field .wrap_remove { + height: 38px; +} + +.repository.new.release .field .attachment_edit { + width: 450px !important; +} diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 496e517bc8..80e2e1cb8b 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -1923,157 +1923,6 @@ flex: 1 } -.repository.release #release-list { - border-top: 1px solid var(--color-secondary); - margin-top: 20px; - padding-top: 15px; - padding-left: 0; -} - -.repository.release #release-list .release-list-title { - font-size: 2rem; - font-weight: normal; - margin-top: -4px; - margin-bottom: 0; -} - -.repository.release #release-list > li { - list-style: none; -} - -.repository.release #release-list > li .meta, -.repository.release #release-list > li .detail { - padding-top: 30px; - padding-bottom: 40px; -} - -.repository.release #release-list > li .meta { - text-align: right; - position: relative; -} - -.repository.release #release-list > li .meta .label { - margin-right: 0; -} - -.repository.release #release-list > li .meta .commit { - display: block; - margin-top: 10px; -} - -.repository.release #release-list > li .meta .choose { - margin-top: 15px; -} - -.repository.release #release-list > li .meta .choose .button { - margin-right: 0; -} - -.repository.release #release-list > li .detail { - border-left: 2px solid var(--color-secondary); -} - -.repository.release #release-list > li .detail .author img { - margin-bottom: 3px; -} - -.repository.release #release-list > li .detail .download > a .svg { - margin-left: 5px; - margin-right: 5px; -} - -.repository.release #release-list > li .detail .download .list { - padding-left: 0; -} - -.repository.release #release-list > li .detail .download .list li { - list-style: none; - display: block; - padding: 8px; - border: 1px solid var(--color-secondary); - background: var(--color-light); -} - -.repository.release #release-list > li .detail .download .list li a > .text.right { - margin-right: 5px; -} - -.repository.release #release-list > li .detail .download .list li + li { - border-top: 0; -} - -.repository.release #release-list > li .detail .download .list li:first-of-type { - border-radius: var(--border-radius) 0 0 var(--border-radius); -} - -.repository.release #release-list > li .detail .download .list li:last-of-type { - border-radius: 0 var(--border-radius) var(--border-radius) 0; -} - -.repository.release #release-list > li .detail .dot { - width: 10px; - height: 10px; - background-color: var(--color-secondary-dark-3); - z-index: 9; - position: absolute; - display: block; - left: -6px; - top: 40px; - border-radius: 100%; - border: 2.5px solid var(--color-body); -} - -.repository.release #tags-table .tag { - padding: 8px 12px; -} - -.repository.release #tags-table .release-tag-name { - font-size: 18px; - font-weight: normal; -} - -.repository.new.release .target { - min-width: 500px; -} - -.repository.new.release .target #tag-name { - margin-top: -4px; -} - -.repository.new.release .target .at { - margin-left: -5px; - margin-right: 5px; -} - -.repository.new.release .target .selection.dropdown { - padding-top: 10px; - padding-bottom: 10px; -} - -.repository.new.release .prerelease.field { - margin-bottom: 0; -} - -@media (max-width: 438px) { - .repository.new.release .field button, - .repository.new.release .field input { - width: 100%; - } -} - -@media (max-width: 767px) { - .repository.new.release .field button { - margin-bottom: 1em; - } -} - -.repository.new.release .field .wrap_remove { - height: 38px; -} - -.repository.new.release .field .attachment_edit { - width: 450px !important; -} .repository.packages .empty { padding-top: 70px; |