From 998dfea45df9b5dcfdd047202ed92d826efa91d5 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Fri, 5 Jun 2020 00:16:05 +0800 Subject: [PATCH 1/6] ui: Show update branch item in merge box when it's necessary As title, should show it without care about whether this pr can be merged. fix #10959 Signed-off-by: a1012112796 <1012112796@qq.com> --- templates/repo/issue/view_content/pull.tmpl | 35 +++++++++------------ 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index a5d753ac09a04..d87000cc699b3 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -316,26 +316,6 @@ {{end}} {{end}} - {{if gt .Issue.PullRequest.CommitsBehind 0}} -
-
-
- {{svg "octicon-alert" 16}} - {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} -
- {{if .UpdateAllowed}} -
-
- {{.CsrfTokenHtml}} - -
-
- {{end}} -
-
- {{end}} {{else}} {{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} {{if .IsBlockedByApprovals}} @@ -374,6 +354,21 @@ {{end}} {{end}} + + {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken)}} +
+ {{svg "octicon-alert" 16}} + {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} + {{if .UpdateAllowed}} +
+ {{.CsrfTokenHtml}} + +
+ {{end}} +
+ {{end}} From 9d4f7b99b74c6a13b164b25296dc7765b7b96548 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Sat, 6 Jun 2020 00:06:55 +0800 Subject: [PATCH 2/6] fix ui --- templates/repo/issue/view_content/pull.tmpl | 28 ++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index d87000cc699b3..796f992dfc608 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -75,6 +75,7 @@ {{- else}}red{{end}}">{{svg "octicon-git-merge" 32}}
{{template "repo/pulls/status" .}} + {{$canAutoMerge := false}}
{{if .Issue.PullRequest.HasMerged}}
@@ -188,6 +189,25 @@ {{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }}
{{end}} + {{end}} + + {{$canAutoMerge = true}} + {{if (gt .Issue.PullRequest.CommitsBehind 0)}} +
+ {{svg "octicon-alert" 16}} + {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} + {{if .UpdateAllowed}} +
+ {{.CsrfTokenHtml}} + +
+ {{end}} +
+ {{end}} + + {{if and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .RequireSigned) .WillSign)}} {{if .AllowMerge}} {{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} {{$approvers := .Issue.PullRequest.GetApprovers}} @@ -300,6 +320,7 @@
{{else}} +
{{svg "octicon-x" 16}} {{$.i18n.Tr "repo.pulls.no_merge_desc"}} @@ -310,6 +331,7 @@
{{end}} {{else}} +
{{svg "octicon-info" 16}} {{$.i18n.Tr "repo.pulls.no_merge_access"}} @@ -355,15 +377,15 @@ {{end}} {{end}} - {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken)}} + {{if and (gt .Issue.PullRequest.CommitsBehind 0) (not .Issue.IsClosed) (not .Issue.PullRequest.IsChecking) (not .IsPullFilesConflicted) (not .IsPullRequestBroken) (not $canAutoMerge)}}
{{svg "octicon-alert" 16}} {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} {{if .UpdateAllowed}}
{{.CsrfTokenHtml}} -
{{end}} From 7a2abe5503f9755b12db257d6e91b7036cae8877 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Mon, 8 Jun 2020 21:13:00 +0800 Subject: [PATCH 3/6] Fix ui, thanks to @silverwind. Co-authored-by: silverwind --- templates/repo/issue/view_content/pull.tmpl | 27 ++++++++++++--------- web_src/less/_repository.less | 13 ++++++++-- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 9c3ed748754d5..4aa0171b9a8ea 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -193,17 +193,22 @@ {{$canAutoMerge = true}} {{if (gt .Issue.PullRequest.CommitsBehind 0)}} -
- {{svg "octicon-alert" 16}} - {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} - {{if .UpdateAllowed}} -
- {{.CsrfTokenHtml}} - -
- {{end}} +
+
+
+ {{svg "octicon-alert" 16}} + {{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}} +
+
+ {{if .UpdateAllowed}} +
+ {{.CsrfTokenHtml}} + +
+ {{end}} +
{{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 756ad6d6a8a39..19c204759740c 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -995,8 +995,17 @@ > .merge-section { background-color: #f7f7f7; - .item + .item { - padding-top: .5rem; + .item { + padding: .25rem 0; + } + + .item-section { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0; + margin-top: -.25rem; + margin-bottom: -.25rem; } .divider { From 4cb9b913037e58df248eea55f113b642e080ea20 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Mon, 8 Jun 2020 21:30:57 +0800 Subject: [PATCH 4/6] fix lint --- web_src/less/_repository.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 19c204759740c..c0bb56e36eeda 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -996,9 +996,9 @@ background-color: #f7f7f7; .item { - padding: .25rem 0; + padding: .25rem 0; } - + .item-section { display: flex; align-items: center; From f08f37ec530d37cccb58e40a39b450c0ea93b807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=99=BA=E8=B6=85?= <1012112796@qq.com> Date: Tue, 9 Jun 2020 01:06:33 +0800 Subject: [PATCH 5/6] Update templates/repo/issue/view_content/pull.tmpl Co-authored-by: silverwind --- templates/repo/issue/view_content/pull.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 4aa0171b9a8ea..dc4874d243b75 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -389,7 +389,7 @@ {{if .UpdateAllowed}}
{{.CsrfTokenHtml}} -
From d82c2294c092afe0ec54c3e4b9affc218ad5ffcd Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Tue, 9 Jun 2020 01:11:06 +0800 Subject: [PATCH 6/6] Apply review suggestion --- templates/repo/issue/view_content/pull.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index dc4874d243b75..c66e7734a6aff 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -203,7 +203,7 @@ {{if .UpdateAllowed}}
{{.CsrfTokenHtml}} -