work on #1961
This commit is contained in:
		
							parent
							
								
									c9b65f0fdc
								
							
						
					
					
						commit
						134d8e7681
					
				
							
								
								
									
										13
									
								
								cmd/web.go
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								cmd/web.go
									
									
									
									
									
								
							| @ -512,11 +512,14 @@ func runWeb(ctx *cli.Context) { | ||||
| 	}, reqSignIn, middleware.RepoAssignment(true)) | ||||
| 
 | ||||
| 	m.Group("/:username/:reponame", func() { | ||||
| 		m.Get("/releases", middleware.RepoRef(), repo.Releases) | ||||
| 		m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) | ||||
| 		m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) | ||||
| 		m.Get("/labels/", repo.RetrieveLabels, repo.Labels) | ||||
| 		m.Get("/milestones", repo.Milestones) | ||||
| 		m.Group("", func() { | ||||
| 			m.Get("/releases", repo.Releases) | ||||
| 			m.Get("/^:type(issues|pulls)$", repo.RetrieveLabels, repo.Issues) | ||||
| 			m.Get("/^:type(issues|pulls)$/:index", repo.ViewIssue) | ||||
| 			m.Get("/labels/", repo.RetrieveLabels, repo.Labels) | ||||
| 			m.Get("/milestones", repo.Milestones) | ||||
| 		}, middleware.RepoRef()) | ||||
| 
 | ||||
| 		m.Get("/branches", repo.Branches) | ||||
| 		m.Get("/archive/*", repo.Download) | ||||
| 
 | ||||
|  | ||||
| @ -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_success = Label has been deleted successfully! | ||||
| 
 | ||||
| pulls.new = New Pull Request | ||||
| pulls.compare_changes = Compare Changes | ||||
| pulls.compare_changes_desc = Compare two branches and make a pull request for changes. | ||||
| 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.title = Title | ||||
| release.content = Content | ||||
| release.write = Write | ||||
| release.preview = Preview | ||||
| release.loading = Loading... | ||||
| release.prerelease_desc = This is a pre-release | ||||
| release.prerelease_helper = We’ll point out that this release is not production-ready. | ||||
| release.cancel = Cancel | ||||
|  | ||||
| @ -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.
 | ||||
| func (u *User) CanEditGitHook() bool { | ||||
| 	return u.IsAdmin || u.AllowGitHook | ||||
|  | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -59,6 +59,7 @@ func Issues(ctx *middleware.Context) { | ||||
| 	if isPullList { | ||||
| 		ctx.Data["Title"] = ctx.Tr("repo.pulls") | ||||
| 		ctx.Data["PageIsPullList"] = true | ||||
| 		ctx.Data["HasForkedRepo"] = ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID) | ||||
| 	} else { | ||||
| 		ctx.Data["Title"] = ctx.Tr("repo.issues") | ||||
| 		ctx.Data["PageIsIssueList"] = true | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| <div class="repository labels"> | ||||
| 	{{template "repo/header" .}} | ||||
| 	<div class="ui container"> | ||||
|     {{template "repo/sidebar" .}} | ||||
| 		<div class="navbar"> | ||||
| 			{{template "repo/issue/navbar" .}} | ||||
| 			{{if .IsRepositoryAdmin}} | ||||
|  | ||||
| @ -2,10 +2,15 @@ | ||||
| <div class="repository"> | ||||
| 	{{template "repo/header" .}} | ||||
| 	<div class="ui container"> | ||||
|     {{template "repo/sidebar" .}} | ||||
| 		<div class="navbar"> | ||||
| 			{{template "repo/issue/navbar" .}} | ||||
| 			<div class="ui right"> | ||||
| 				{{if .PageIsIssueList}} | ||||
| 				<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 class="ui divider"></div> | ||||
|  | ||||
| @ -2,6 +2,7 @@ | ||||
| <div class="repository milestones"> | ||||
| 	{{template "repo/header" .}} | ||||
| 	<div class="ui container"> | ||||
|     {{template "repo/sidebar" .}} | ||||
| 		<div class="navbar"> | ||||
| 			{{template "repo/issue/navbar" .}} | ||||
| 			{{if .IsRepositoryAdmin}} | ||||
|  | ||||
| @ -1,6 +1,8 @@ | ||||
| <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 .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 .PageIsMilestones}}active{{end}} item" href="{{.RepoLink}}/milestones">{{.i18n.Tr "repo.milestones"}}</a> | ||||
| </div> | ||||
| @ -1,21 +1,21 @@ | ||||
| {{if not .IsBareRepo}} | ||||
| <div class="ui {{if .IsRepositoryAdmin}}five{{else}}four{{end}} item menu"> | ||||
|     <a class="item" href="{{.RepoLink}}/issues"> | ||||
|       <i class="icon octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui blue label">{{.Repository.NumOpenIssues}}</span> | ||||
|     </a> | ||||
|     <a class="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}}"> | ||||
|       <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"> | ||||
|       <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"> | ||||
|       <i class="icon octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}} | ||||
|     </a> | ||||
|     {{end}} | ||||
|   <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> | ||||
|   </a> | ||||
|   <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}}"> | ||||
|     <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"> | ||||
|     <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"> | ||||
|     <i class="icon octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}} | ||||
|   </a> | ||||
|   {{end}} | ||||
| </div> | ||||
| {{end}} | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user