Browse Source

work on #1961

pull/1962/head
Unknwon 9 years ago
parent
commit
134d8e7681
  1. 13
      cmd/web.go
  2. 4
      conf/locale/locale_en-US.ini
  3. 6
      models/user.go
  4. 4
      modules/bindata/bindata.go
  5. 1
      routers/repo/issue.go
  6. 1
      templates/repo/issue/labels.tmpl
  7. 5
      templates/repo/issue/list.tmpl
  8. 1
      templates/repo/issue/milestones.tmpl
  9. 2
      templates/repo/issue/navbar.tmpl
  10. 34
      templates/repo/sidebar.tmpl

13
cmd/web.go

@ -512,11 +512,14 @@ func runWeb(ctx *cli.Context) {
}, reqSignIn, middleware.RepoAssignment(true)) }, reqSignIn, middleware.RepoAssignment(true))
m.Group("/:username/:reponame", func() { m.Group("/:username/:reponame", func() {
m.Get("/releases", middleware.RepoRef(), repo.Releases) m.Group("", func() {
m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) m.Get("/releases", repo.Releases)
m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues)
m.Get("/labels/", repo.RetrieveLabels, repo.Labels) m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue)
m.Get("/milestones", repo.Milestones) m.Get("/labels/", repo.RetrieveLabels, repo.Labels)
m.Get("/milestones", repo.Milestones)
}, middleware.RepoRef())
m.Get("/branches", repo.Branches) m.Get("/branches", repo.Branches)
m.Get("/archive/*", repo.Download) m.Get("/archive/*", repo.Download)

4
conf/locale/locale_en-US.ini

@ -480,6 +480,7 @@ issues.label_deletion = Label Deletion
issues.label_deletion_desc = Delete this label will remove its information in all related issues. Do you want to continue? issues.label_deletion_desc = Delete this label will remove its information in all related issues. Do you want to continue?
issues.label_deletion_success = Label has been deleted successfully! issues.label_deletion_success = Label has been deleted successfully!
pulls.new = New Pull Request
pulls.compare_changes = Compare Changes pulls.compare_changes = Compare Changes
pulls.compare_changes_desc = Compare two branches and make a pull request for changes. pulls.compare_changes_desc = Compare two branches and make a pull request for changes.
pulls.compare_base = base pulls.compare_base = base
@ -639,6 +640,9 @@ release.target = Target
release.tag_helper = Choose an existing tag, or create a new tag on publish. release.tag_helper = Choose an existing tag, or create a new tag on publish.
release.title = Title release.title = Title
release.content = Content release.content = Content
release.write = Write
release.preview = Preview
release.loading = Loading...
release.prerelease_desc = This is a pre-release release.prerelease_desc = This is a pre-release
release.prerelease_helper = We’ll point out that this release is not production-ready. release.prerelease_helper = We’ll point out that this release is not production-ready.
release.cancel = Cancel release.cancel = Cancel

6
models/user.go

@ -109,6 +109,12 @@ func (u *User) AfterSet(colName string, _ xorm.Cell) {
} }
} }
// HasForkedRepo checks if user has already forked a repository with given ID.
func (u *User) HasForkedRepo(repoID int64) bool {
_, has := HasForkedRepo(u.Id, repoID)
return has
}
// CanEditGitHook returns true if user can edit Git hooks. // CanEditGitHook returns true if user can edit Git hooks.
func (u *User) CanEditGitHook() bool { func (u *User) CanEditGitHook() bool {
return u.IsAdmin || u.AllowGitHook return u.IsAdmin || u.AllowGitHook

4
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

1
routers/repo/issue.go

@ -59,6 +59,7 @@ func Issues(ctx *middleware.Context) {
if isPullList { if isPullList {
ctx.Data["Title"] = ctx.Tr("repo.pulls") ctx.Data["Title"] = ctx.Tr("repo.pulls")
ctx.Data["PageIsPullList"] = true ctx.Data["PageIsPullList"] = true
ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)
} else { } else {
ctx.Data["Title"] = ctx.Tr("repo.issues") ctx.Data["Title"] = ctx.Tr("repo.issues")
ctx.Data["PageIsIssueList"] = true ctx.Data["PageIsIssueList"] = true

1
templates/repo/issue/labels.tmpl

@ -2,6 +2,7 @@
<div class="repository labels"> <div class="repository labels">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
{{template "repo/sidebar" .}}
<div class="navbar"> <div class="navbar">
{{template "repo/issue/navbar" .}} {{template "repo/issue/navbar" .}}
{{if .IsRepositoryAdmin}} {{if .IsRepositoryAdmin}}

5
templates/repo/issue/list.tmpl

@ -2,10 +2,15 @@
<div class="repository"> <div class="repository">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
{{template "repo/sidebar" .}}
<div class="navbar"> <div class="navbar">
{{template "repo/issue/navbar" .}} {{template "repo/issue/navbar" .}}
<div class="ui right"> <div class="ui right">
{{if .PageIsIssueList}}
<a class="ui green button" href="{{.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a> <a class="ui green button" href="{{.RepoLink}}/issues/new">{{.i18n.Tr "repo.issues.new"}}</a>
{{else}}
<a class="ui green button {{if not .HasForkedRepo}}disabled{{end}}" href="{{.RepoLink}}/compare/{{.BranchName}}...{{.SignedUserName}}:{{.BranchName}}">{{.i18n.Tr "repo.pulls.new"}}</a>
{{end}}
</div> </div>
</div> </div>
<div class="ui divider"></div> <div class="ui divider"></div>

1
templates/repo/issue/milestones.tmpl

@ -2,6 +2,7 @@
<div class="repository milestones"> <div class="repository milestones">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
{{template "repo/sidebar" .}}
<div class="navbar"> <div class="navbar">
{{template "repo/issue/navbar" .}} {{template "repo/issue/navbar" .}}
{{if .IsRepositoryAdmin}} {{if .IsRepositoryAdmin}}

2
templates/repo/issue/navbar.tmpl

@ -1,6 +1,8 @@
<div class="ui compact small menu"> <div class="ui compact small menu">
{{if not .CommitsCount}}
<a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">{{.i18n.Tr "repo.issues"}}</a> <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">{{.i18n.Tr "repo.issues"}}</a>
<a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">{{.i18n.Tr "repo.pulls"}}</a> <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">{{.i18n.Tr "repo.pulls"}}</a>
{{end}}
<a class="{{if .PageIsLabels}}active{{end}} item" href="{{.RepoLink}}/labels">{{.i18n.Tr "repo.labels"}}</a> <a class="{{if .PageIsLabels}}active{{end}} item" href="{{.RepoLink}}/labels">{{.i18n.Tr "repo.labels"}}</a>
<a class="{{if .PageIsMilestones}}active{{end}} item" href="{{.RepoLink}}/milestones">{{.i18n.Tr "repo.milestones"}}</a> <a class="{{if .PageIsMilestones}}active{{end}} item" href="{{.RepoLink}}/milestones">{{.i18n.Tr "repo.milestones"}}</a>
</div> </div>

34
templates/repo/sidebar.tmpl

@ -1,21 +1,21 @@
{{if not .IsBareRepo}} {{if not .IsBareRepo}}
<div class="ui {{if .IsRepositoryAdmin}}five{{else}}four{{end}} item menu"> <div class="ui {{if .IsRepositoryAdmin}}five{{else}}four{{end}} item menu">
<a class="item" href="{{.RepoLink}}/issues"> <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
<i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui blue label">{{.Repository.NumOpenIssues}}</span> <i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui blue label">{{.Repository.NumOpenIssues}}</span>
</a> </a>
<a class="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="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="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="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}}
</div> </div>
{{end}} {{end}}
Loading…
Cancel
Save