From 5409dec8fd29dfb7fcd7c0afb8a2d9682abc48b1 Mon Sep 17 00:00:00 2001 From: 6543 <24977596+6543@users.noreply.github.com> Date: Mon, 26 Aug 2019 12:47:41 +0200 Subject: [PATCH] [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 :) --- templates/admin/config.tmpl | 36 ++++++++++++++++----------------- templates/repo/branch/list.tmpl | 2 +- templates/repo/graph.tmpl | 5 ----- 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index b8bf1ec028..79eec31dfd 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -88,8 +88,8 @@
{{.i18n.Tr "admin.config.ssh_minimum_key_size_check"}}
{{if .SSH.MinimumKeySizeCheck}} -
{{.i18n.Tr "admin.config.ssh_minimum_key_sizes"}}
-
{{.SSH.MinimumKeySizes}}
+
{{.i18n.Tr "admin.config.ssh_minimum_key_sizes"}}
+
{{.SSH.MinimumKeySizes}}
{{end}} {{end}} {{end}} @@ -120,20 +120,20 @@
{{.i18n.Tr "admin.config.db_type"}}
{{.DbCfg.Type}}
{{if not (or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb"))}} -
{{.i18n.Tr "admin.config.db_host"}}
-
{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}
-
{{.i18n.Tr "admin.config.db_name"}}
-
{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}
-
{{.i18n.Tr "admin.config.db_user"}}
-
{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}
+
{{.i18n.Tr "admin.config.db_host"}}
+
{{if .DbCfg.Host}}{{.DbCfg.Host}}{{else}}-{{end}}
+
{{.i18n.Tr "admin.config.db_name"}}
+
{{if .DbCfg.Name}}{{.DbCfg.Name}}{{else}}-{{end}}
+
{{.i18n.Tr "admin.config.db_user"}}
+
{{if .DbCfg.User}}{{.DbCfg.User}}{{else}}-{{end}}
{{end}} {{if eq .DbCfg.Type "postgres"}} -
{{.i18n.Tr "admin.config.db_ssl_mode"}}
-
{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}
+
{{.i18n.Tr "admin.config.db_ssl_mode"}}
+
{{if .DbCfg.SSLMode}}{{.DbCfg.SSLMode}}{{else}}-{{end}}
{{end}} {{if or (eq .DbCfg.Type "sqlite3") (eq .DbCfg.Type "tidb")}} -
{{.i18n.Tr "admin.config.db_path"}}
-
{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}
+
{{.i18n.Tr "admin.config.db_path"}}
+
{{if .DbCfg.Path}}{{.DbCfg.Path}}{{else}}-{{end}}
{{end}} @@ -250,14 +250,14 @@
{{.i18n.Tr "admin.config.cache_adapter"}}
{{.CacheAdapter}}
{{if eq .CacheAdapter "memory"}} -
{{.i18n.Tr "admin.config.cache_interval"}}
-
{{.CacheInterval}} {{.i18n.Tr "tool.raw_seconds"}}
+
{{.i18n.Tr "admin.config.cache_interval"}}
+
{{.CacheInterval}} {{.i18n.Tr "tool.raw_seconds"}}
{{end}} {{if .CacheConn}} -
{{.i18n.Tr "admin.config.cache_conn"}}
-
{{.CacheConn}}
-
{{.i18n.Tr "admin.config.cache_item_ttl"}}
-
{{.CacheItemTTL}}
+
{{.i18n.Tr "admin.config.cache_conn"}}
+
{{.CacheConn}}
+
{{.i18n.Tr "admin.config.cache_item_ttl"}}
+
{{.CacheItemTTL}}
{{end}} diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 370e323960..9c53f4e67a 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -75,7 +75,7 @@ {{if not .LatestPullRequest}} - {{if and (not .IsDeleted) $.AllowsPulls}} + {{if and (not .IsDeleted) $.AllowsPulls (gt .CommitsAhead 0)}} diff --git a/templates/repo/graph.tmpl b/templates/repo/graph.tmpl index 14fbfac6d7..2e8d0b5d91 100644 --- a/templates/repo/graph.tmpl +++ b/templates/repo/graph.tmpl @@ -2,8 +2,6 @@
{{template "repo/header" .}}
- -

{{.i18n.Tr "repo.commit_graph"}}

@@ -37,9 +35,6 @@
- - -
{{template "base/footer" .}}