[Branch View] show "New Pull Request" Button only if posible (#7977)

* add check Commits Ahead is gt 0

* code format
to start drone-ci test again
and formate code is also nice :)
release/v1.15
6543 2019-08-26 12:47:41 +02:00 committed by Lauris BH
parent c9546d4cdd
commit 5409dec8fd
3 changed files with 19 additions and 24 deletions

View File

@ -88,8 +88,8 @@
<dt>{{.i18n.Tr "admin.config.ssh_minimum_key_size_check"}}</dt> <dt>{{.i18n.Tr "admin.config.ssh_minimum_key_size_check"}}</dt>
<dd><i class="fa fa{{if .SSH.MinimumKeySizeCheck}}-check{{end}}-square-o"></i></dd> <dd><i class="fa fa{{if .SSH.MinimumKeySizeCheck}}-check{{end}}-square-o"></i></dd>
{{if .SSH.MinimumKeySizeCheck}} {{if .SSH.MinimumKeySizeCheck}}
<dt>{{.i18n.Tr "admin.config.ssh_minimum_key_sizes"}}</dt> <dt>{{.i18n.Tr "admin.config.ssh_minimum_key_sizes"}}</dt>
<dd>{{.SSH.MinimumKeySizes}}</dd> <dd>{{.SSH.MinimumKeySizes}}</dd>
{{end}} {{end}}
{{end}} {{end}}
{{end}} {{end}}
@ -120,20 +120,20 @@
<dt>{{.i18n.Tr "admin.config.db_type"}}</dt> <dt>{{.i18n.Tr "admin.config.db_type"}}</dt>
<dd>{{.DbCfg.Type}}</dd> <dd>{{.DbCfg.Type}}</dd>
{{if not (or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb"))}} {{if not (or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb"))}}
<dt>{{.i18n.Tr "admin.config.db_host"}}</dt> <dt>{{.i18n.Tr "admin.config.db_host"}}</dt>
<dd>{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}</dd> <dd>{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_name"}}</dt> <dt>{{.i18n.Tr "admin.config.db_name"}}</dt>
<dd>{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}</dd> <dd>{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}</dd>
<dt>{{.i18n.Tr "admin.config.db_user"}}</dt> <dt>{{.i18n.Tr "admin.config.db_user"}}</dt>
<dd>{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}</dd> <dd>{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}</dd>
{{end}} {{end}}
{{if eq .DbCfg.Type "postgres"}} {{if eq .DbCfg.Type "postgres"}}
<dt>{{.i18n.Tr "admin.config.db_ssl_mode"}}</dt> <dt>{{.i18n.Tr "admin.config.db_ssl_mode"}}</dt>
<dd>{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}</dd> <dd>{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}</dd>
{{end}} {{end}}
{{if or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb")}} {{if or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb")}}
<dt>{{.i18n.Tr "admin.config.db_path"}}</dt> <dt>{{.i18n.Tr "admin.config.db_path"}}</dt>
<dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}</dd> <dd>{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}</dd>
{{end}} {{end}}
</dl> </dl>
</div> </div>
@ -250,14 +250,14 @@
<dt>{{.i18n.Tr "admin.config.cache_adapter"}}</dt> <dt>{{.i18n.Tr "admin.config.cache_adapter"}}</dt>
<dd>{{.CacheAdapter}}</dd> <dd>{{.CacheAdapter}}</dd>
{{if eq .CacheAdapter "memory"}} {{if eq .CacheAdapter "memory"}}
<dt>{{.i18n.Tr "admin.config.cache_interval"}}</dt> <dt>{{.i18n.Tr "admin.config.cache_interval"}}</dt>
<dd>{{.CacheInterval}} {{.i18n.Tr "tool.raw_seconds"}}</dd> <dd>{{.CacheInterval}} {{.i18n.Tr "tool.raw_seconds"}}</dd>
{{end}} {{end}}
{{if .CacheConn}} {{if .CacheConn}}
<dt>{{.i18n.Tr "admin.config.cache_conn"}}</dt> <dt>{{.i18n.Tr "admin.config.cache_conn"}}</dt>
<dd><code>{{.CacheConn}}</code></dd> <dd><code>{{.CacheConn}}</code></dd>
<dt>{{.i18n.Tr "admin.config.cache_item_ttl"}}</dt> <dt>{{.i18n.Tr "admin.config.cache_item_ttl"}}</dt>
<dd><code>{{.CacheItemTTL}}</code></dd> <dd><code>{{.CacheItemTTL}}</code></dd>
{{end}} {{end}}
</dl> </dl>
</div> </div>

View File

@ -75,7 +75,7 @@
</td> </td>
<td class="two wide right aligned"> <td class="two wide right aligned">
{{if not .LatestPullRequest}} {{if not .LatestPullRequest}}
{{if and (not .IsDeleted) $.AllowsPulls}} {{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}}
<a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}"> <a href="{{$.RepoLink}}/compare/{{$.DefaultBranch | EscapePound}}...{{if ne $.Repository.Owner.Name $.Owner.Name}}{{$.Owner.Name}}:{{end}}{{.Name | EscapePound}}">
<button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button> <button id="new-pull-request" class="ui compact basic button">{{$.i18n.Tr "repo.pulls.compare_changes"}}</button>
</a> </a>

View File

@ -2,8 +2,6 @@
<div class="repository commits"> <div class="repository commits">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div id="git-graph-container" class="ui segment"> <div id="git-graph-container" class="ui segment">
<h1>{{.i18n.Tr "repo.commit_graph"}}</h1> <h1>{{.i18n.Tr "repo.commit_graph"}}</h1>
<div id="rel-container"> <div id="rel-container">
@ -37,9 +35,6 @@
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}