Browse Source

repo sidebar active class

pull/1962/head
Unknwon 9 years ago
parent
commit
29ed7872f8
  1. 2
      cmd/web.go
  2. 5
      routers/repo/release.go
  3. 6
      templates/repo/sidebar.tmpl

2
cmd/web.go

@ -463,6 +463,8 @@ func runWeb(ctx *cli.Context) {
m.Post("/delete", repo.DeleteDeployKey)
})
}, func(ctx *middleware.Context) {
ctx.Data["PageIsSettings"] = true
})
}, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin, middleware.RepoRef())

5
routers/repo/release.go

@ -19,6 +19,7 @@ const (
func Releases(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
ctx.Data["PageIsReleaseList"] = true
rawTags, err := ctx.Repo.GitRepo.GetTags()
if err != nil {
@ -138,12 +139,14 @@ func Releases(ctx *middleware.Context) {
func NewRelease(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["tag_target"] = ctx.Repo.Repository.DefaultBranch
ctx.HTML(200, RELEASE_NEW)
}
func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
ctx.Data["PageIsReleaseList"] = true
if ctx.HasError() {
ctx.HTML(200, RELEASE_NEW)
@ -196,6 +199,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) {
func EditRelease(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["PageIsEditRelease"] = true
tagName := ctx.Params(":tagname")
@ -219,6 +223,7 @@ func EditRelease(ctx *middleware.Context) {
func EditReleasePost(ctx *middleware.Context, form auth.EditReleaseForm) {
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
ctx.Data["PageIsReleaseList"] = true
ctx.Data["PageIsEditRelease"] = true
tagName := ctx.Params(":tagname")

6
templates/repo/sidebar.tmpl

@ -6,14 +6,14 @@
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
<i class="icon octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui blue label">{{.Repository.NumOpenPulls}}</span>
</a>
<a class="item" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}">
<a class="{{if .PageIsCommits}}active{{end}} item" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}">
<i class="icon octicon octicon-history"></i> {{.i18n.Tr "repo.commits"}} <span class="ui blue label">{{.CommitsCount}}</span>
</a>
<a class="item" href="{{.RepoLink}}/releases">
<a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
<i class="icon octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui blue label">{{.Repository.NumTags}}</span>
</a>
{{if .IsRepositoryAdmin}}
<a class="item" href="{{.RepoLink}}/settings">
<a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
<i class="icon octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}}
</a>
{{end}}

Loading…
Cancel
Save