Browse Source

repo/branches: hide buttons for regular users

pull/4280/head
Unknwon 8 years ago
parent
commit
9713016637
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      public/css/gogs.css
  2. 2
      public/less/_repository.less
  3. 4
      templates/repo/branches/all.tmpl
  4. 16
      templates/repo/branches/overview.tmpl

2
public/css/gogs.css

@ -1232,7 +1232,7 @@ footer .ui.language .menu {
} }
.repository.branches .ui.list > .item { .repository.branches .ui.list > .item {
margin: 0; margin: 0;
line-height: 2em; line-height: 31px;
} }
.repository.branches .ui.list > .item:not(:last-child) { .repository.branches .ui.list > .item:not(:last-child) {
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;

2
public/less/_repository.less

@ -155,7 +155,7 @@
padding: 0; padding: 0;
>.item { >.item {
margin: 0; margin: 0;
line-height: 2em; line-height: 31px;
&:not(:last-child) { &:not(:last-child) {
border-bottom: 1px solid #DDD; border-bottom: 1px solid #DDD;
} }

4
templates/repo/branches/all.tmpl

@ -17,9 +17,9 @@
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span> <span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
</div> </div>
<div class="ui four wide column"> <div class="ui four wide column">
{{if eq $.BranchName .Name}} {{if and (eq $.BranchName .Name) $.IsRepositoryWriter}}
<a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{$.i18n.Tr "repo.branches.change_default_branch"}}</a> <a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{$.i18n.Tr "repo.branches.change_default_branch"}}</a>
{{else}} {{else if $.IsRepositoryAdmin}}
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.DefaultBranch.Name}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a> <a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.DefaultBranch.Name}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
{{end}} {{end}}
</div> </div>

16
templates/repo/branches/overview.tmpl

@ -15,9 +15,11 @@
{{$timeSince := TimeSince .DefaultBranch.Commit.Committer.When $.Lang}} {{$timeSince := TimeSince .DefaultBranch.Commit.Committer.When $.Lang}}
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .DefaultBranch.Commit.Committer.Name | Safe}}</span> <span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .DefaultBranch.Commit.Committer.Name | Safe}}</span>
</div> </div>
<div class="ui four wide column"> {{if $.IsRepositoryAdmin}}
<a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{.i18n.Tr "repo.branches.change_default_branch"}}</a> <div class="ui four wide column">
</div> <a class="ui basic blue button" href="{{$.RepoLink}}/settings/branches">{{.i18n.Tr "repo.branches.change_default_branch"}}</a>
</div>
{{end}}
</div> </div>
</div> </div>
@ -33,9 +35,11 @@
{{$timeSince := TimeSince .Commit.Committer.When $.Lang}} {{$timeSince := TimeSince .Commit.Committer.When $.Lang}}
<span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span> <span class="ui text light grey">{{$.i18n.Tr "repo.branches.updated_by" $timeSince .Commit.Committer.Name | Safe}}</span>
</div> </div>
<div class="ui four wide column"> {{if $.IsRepositoryWriter}}
<a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.DefaultBranch.Name}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a> <div class="ui four wide column">
</div> <a class="ui basic button" href="{{$.RepoLink}}/compare/{{$.DefaultBranch.Name}}...{{.Name}}"><i class="octicon octicon-git-pull-request"></i> {{$.i18n.Tr "repo.pulls.new"}}</a>
</div>
{{end}}
</div> </div>
{{end}} {{end}}
</div> </div>

Loading…
Cancel
Save