unified name: IsViewBranch, IsViewCommit and IsViewTag

This commit is contained in:
Unknwon 2015-12-09 00:32:53 -05:00
parent 989f30eb41
commit a576224d0e
9 changed files with 18 additions and 21 deletions

View File

@ -265,8 +265,8 @@ ADDR =
; For "smtp" mode only ; For "smtp" mode only
[log.smtp] [log.smtp]
LEVEL = LEVEL =
; Name displayed in mail title, default is "Diagnostic message from serve" ; Name displayed in mail title, default is "Diagnostic message from server"
SUBJECT = Diagnostic message from serve SUBJECT = Diagnostic message from server
; Mail server ; Mail server
HOST = HOST =
; Mailer user name and password ; Mailer user name and password

View File

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.7.35.1208 Beta" const APP_VER = "0.7.35.1209 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View File

@ -29,9 +29,9 @@ import (
type RepoContext struct { type RepoContext struct {
AccessMode models.AccessMode AccessMode models.AccessMode
IsWatching bool IsWatching bool
IsBranch bool IsViewBranch bool
IsTag bool IsViewTag bool
IsCommit bool IsViewCommit bool
Repository *models.Repository Repository *models.Repository
Owner *models.User Owner *models.User
Commit *git.Commit Commit *git.Commit

View File

@ -263,7 +263,7 @@ func RepoRef() macaron.Handler {
return return
} }
ctx.Repo.CommitID = ctx.Repo.Commit.ID.String() ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
ctx.Repo.IsBranch = true ctx.Repo.IsViewBranch = true
} else { } else {
hasMatched := false hasMatched := false
@ -286,7 +286,7 @@ func RepoRef() macaron.Handler {
} }
if ctx.Repo.GitRepo.IsBranchExist(refName) { if ctx.Repo.GitRepo.IsBranchExist(refName) {
ctx.Repo.IsBranch = true ctx.Repo.IsViewBranch = true
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommitOfBranch(refName) ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommitOfBranch(refName)
if err != nil { if err != nil {
@ -296,7 +296,7 @@ func RepoRef() macaron.Handler {
ctx.Repo.CommitID = ctx.Repo.Commit.ID.String() ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
} else if ctx.Repo.GitRepo.IsTagExist(refName) { } else if ctx.Repo.GitRepo.IsTagExist(refName) {
ctx.Repo.IsTag = true ctx.Repo.IsViewTag = true
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommitOfTag(refName) ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommitOfTag(refName)
if err != nil { if err != nil {
ctx.Handle(500, "GetCommitOfTag", err) ctx.Handle(500, "GetCommitOfTag", err)
@ -304,7 +304,7 @@ func RepoRef() macaron.Handler {
} }
ctx.Repo.CommitID = ctx.Repo.Commit.ID.String() ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
} else if len(refName) == 40 { } else if len(refName) == 40 {
ctx.Repo.IsCommit = true ctx.Repo.IsViewCommit = true
ctx.Repo.CommitID = refName ctx.Repo.CommitID = refName
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommit(refName) ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommit(refName)
@ -321,9 +321,9 @@ func RepoRef() macaron.Handler {
ctx.Repo.BranchName = refName ctx.Repo.BranchName = refName
ctx.Data["BranchName"] = ctx.Repo.BranchName ctx.Data["BranchName"] = ctx.Repo.BranchName
ctx.Data["CommitID"] = ctx.Repo.CommitID ctx.Data["CommitID"] = ctx.Repo.CommitID
ctx.Data["IsBranch"] = ctx.Repo.IsBranch ctx.Data["IsViewBranch"] = ctx.Repo.IsViewBranch
ctx.Data["IsTag"] = ctx.Repo.IsTag ctx.Data["IsViewTag"] = ctx.Repo.IsViewTag
ctx.Data["IsCommit"] = ctx.Repo.IsCommit ctx.Data["IsViewCommit"] = ctx.Repo.IsViewCommit
ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount() ctx.Repo.CommitsCount, err = ctx.Repo.Commit.CommitsCount()
if err != nil { if err != nil {

View File

@ -53,9 +53,6 @@ func Home(ctx *middleware.Context) {
treeLink += "/" + treename treeLink += "/" + treename
} }
isViewBranch := ctx.Repo.IsBranch
ctx.Data["IsViewBranch"] = isViewBranch
treePath := treename treePath := treename
if len(treePath) != 0 { if len(treePath) != 0 {
treePath = treePath + "/" treePath = treePath + "/"

View File

@ -1 +1 @@
0.7.35.1208 Beta 0.7.35.1209 Beta

View File

@ -39,14 +39,14 @@
</span> </span>
</a> </a>
<a class="reference column" href="#" data-target="#tag-list"> <a class="reference column" href="#" data-target="#tag-list">
<span class="text {{if .IsTag}}black{{end}}"> <span class="text {{if .IsViewTag}}black{{end}}">
<i class="reference tags icon"></i> {{.i18n.Tr "repo.tags"}} <i class="reference tags icon"></i> {{.i18n.Tr "repo.tags"}}
</span> </span>
</a> </a>
</div> </div>
</div> </div>
</div> </div>
<div id="branch-list" class="scrolling menu" {{if .IsTag}}style="display: none"{{end}}> <div id="branch-list" class="scrolling menu" {{if .IsViewTag}}style="display: none"{{end}}>
{{range .Branches}} {{range .Branches}}
<div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/src/{{EscapePound .}}">{{.}}</div> <div class="item {{if eq $.BranchName .}}selected{{end}}" data-url="{{$.RepoLink}}/src/{{EscapePound .}}">{{.}}</div>
{{end}} {{end}}

View File

@ -14,7 +14,7 @@
{{if not .ReadmeInList}} {{if not .ReadmeInList}}
<div class="ui right"> <div class="ui right">
<div class="ui small grey basic buttons"> <div class="ui small grey basic buttons">
{{if not .IsCommit}} {{if not .IsViewCommit}}
<a class="ui button" href="{{.RepoLink}}/src/{{.CommitID}}/{{EscapePound .TreeName}}">{{.i18n.Tr "repo.file_permalink"}}</a> <a class="ui button" href="{{.RepoLink}}/src/{{.CommitID}}/{{EscapePound .TreeName}}">{{.i18n.Tr "repo.file_permalink"}}</a>
{{end}} {{end}}
<a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreeName}}">{{.i18n.Tr "repo.file_history"}}</a> <a class="ui button" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{EscapePound .TreeName}}">{{.i18n.Tr "repo.file_history"}}</a>

View File

@ -18,7 +18,7 @@
<i class="filter icon"></i> <i class="filter icon"></i>
<input name="search" placeholder="{{.i18n.Tr "repo.wiki.filter_page"}}..."> <input name="search" placeholder="{{.i18n.Tr "repo.wiki.filter_page"}}...">
</div> </div>
<div class="scrolling menu" {{if .IsTag}}style="display: none"{{end}}> <div class="scrolling menu">
{{range .Pages}} {{range .Pages}}
<div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</div> <div class="item {{if eq $.Title .Name}}selected{{end}}" data-url="{{$.RepoLink}}/wiki/{{.URL}}">{{.Name}}</div>
{{end}} {{end}}