repo sidebar active class

This commit is contained in:
Unknwon 2015-11-16 11:16:52 -05:00
parent 5dc3dd1704
commit 29ed7872f8
3 changed files with 10 additions and 3 deletions

View file

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

View file

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

View file

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