Explorar o código

[GINR] Added gray pull request button i

should be visible when pull requests are disabled from the repository settings.
Also fixed a typo in templates/repo/home.tmpl
Kateryna Nosenko %!s(int64=7) %!d(string=hai) anos
pai
achega
45fa2c72bc
Modificáronse 3 ficheiros con 7 adicións e 1 borrados
  1. 1 0
      pkg/context/repo.go
  2. 1 1
      templates/repo/header.tmpl
  3. 5 0
      templates/repo/home.tmpl

+ 1 - 0
pkg/context/repo.go

@@ -239,6 +239,7 @@ func RepoAssignment(pages ...bool) macaron.Handler {
 		if c.IsLogged {
 			c.Data["IsWatchingRepo"] = models.IsWatching(c.User.ID, repo.ID)
 			c.Data["IsStaringRepo"] = models.IsStaring(c.User.ID, repo.ID)
+			c.Data["HasForked"] = c.User.HasForkedRepo(c.Repo.Repository.ID)
 		}
 
 		// repo is bare and display enable

+ 1 - 1
templates/repo/header.tmpl

@@ -25,7 +25,7 @@
 							</div>
 							{{if .CanBeForked}}
 							<div class="ui labeled button" tabindex="0"
-									 data-tooltip="Pleaese note: annexed file content will not be forked" data-position="bottom center">
+									 data-tooltip="Please note: annexed file content will not be forked" data-position="bottom center">
 									<a class="ui basic button {{if eq .OwnerID $.LoggedUserID}}poping up{{end}}" href="{{AppSubURL}}/repo/fork/{{.ID}}">
 										<i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
 									</a>

+ 5 - 0
templates/repo/home.tmpl

@@ -29,6 +29,11 @@
 						<button class="ui green small button"><i class="octicon octicon-git-compare"></i></button>
 					</a>
 				</div>
+				{{else if or .IsRepositoryWriter .HasForked}}
+					<div class="fitted item"
+							data-tooltip="Pull requests have been disabled for this repository" data-position="top center">
+							<button class="ui disabled small button"><i class="octicon octicon-git-compare"></i></button>
+					</div>
 			{{end}}
 			{{template "repo/branch_dropdown" .}}
 			<div class="fitted item">