Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: Show update branch item in merge box when it's necessary #11761

Merged
merged 12 commits into from
Jun 13, 2020

Conversation

a1012112796
Copy link
Member

@a1012112796 a1012112796 commented Jun 4, 2020

As title, should show it without care about whether this pr can be merged.

example view:
tmp1

tmp2

tmp3

tmp4

fix #10959

As title, should show it without care about whether
this pr can be merged.

fix go-gitea#10959

Signed-off-by: a1012112796 <1012112796@qq.com>
@silverwind
Copy link
Member

silverwind commented Jun 4, 2020

Button should be vertically centered with the text and not stick to the bottom of the box. Maybe try compact or tiny classes. I'd flexbox-center it but it'd require a few wrapper elements.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 4, 2020
@CirnoT
Copy link
Contributor

CirnoT commented Jun 4, 2020

After fixing styling please ensure it is not broken on other views (when merge button is present, etc)

@a1012112796
Copy link
Member Author

@silverwind @CirnoT done. Thanks for your help.

@zeripath
Copy link
Contributor

zeripath commented Jun 7, 2020

Unfortunately the merge button appears to still have floated out of line from the out of date comment.

@silverwind
Copy link
Member

Maybe split it into it's own "section":

image

diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl
index 110b80ea2..fcdaf9372 100644
--- a/templates/repo/issue/view_content/pull.tmpl
+++ b/templates/repo/issue/view_content/pull.tmpl
@@ -192,19 +192,24 @@
 				{{end}}

 				{{$canAutoMerge = true}}
 				{{if (gt .Issue.PullRequest.CommitsBehind 0)}}
-					<div class="item text grey">
-						<i class="icon icon-octicon">{{svg "octicon-alert" 16}}</i>
-						{{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}}
-						{{if .UpdateAllowed}}
-							<form action="{{.Link}}/update" method="post" class="ui floating right">
-								{{.CsrfTokenHtml}}
-								<button class="ui compact small button" data-do="update">
-									<span class="ui text">{{$.i18n.Tr "repo.pulls.update_branch"}}</span>
-								</button>
-							</form>
-						{{end}}
+					<div class="ui divider"></div>
+					<div class="item item-section text grey">
+						<div class="item-section-left">
+							<i class="icon icon-octicon">{{svg "octicon-alert" 16}}</i>
+							{{$.i18n.Tr "repo.pulls.outdated_with_base_branch"}}
+						</div>
+						<div class="item-section-right">
+							{{if .UpdateAllowed}}
+								<form action="{{.Link}}/update" method="post" class="ui update-branch-form">
+									{{.CsrfTokenHtml}}
+									<button class="ui compact small button" data-do="update">
+										<span class="ui text">{{$.i18n.Tr "repo.pulls.update_branch"}}</span>
+									</button>
+								</form>
+							{{end}}
+						</div>
 					</div>
 				{{end}}

 				{{if and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .RequireSigned) .WillSign)}}
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less
index 756ad6d6a..c0bb56e36 100644
--- a/web_src/less/_repository.less
+++ b/web_src/less/_repository.less
@@ -994,10 +994,19 @@

                     > .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 {
                             margin-left: -1rem;

@silverwind
Copy link
Member

silverwind commented Jun 7, 2020

Maybe we want to apply the style with the divider between each item for all of them, I think it looks cleaner that way, but can be done in another PR.

@silverwind
Copy link
Member

Maybe we want to apply the style with the divider between each item for all of them

BTW, I tried that and came to the conclusion that it's not possible to render all dividers correctly in all cases because of the complex template logic involved so it'd need to be done via CSS .item + .item, but certainly stuff for another PR.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 8, 2020
@lafriks lafriks added the topic/ui Change the appearance of the Gitea UI label Jun 8, 2020
@lafriks lafriks added this to the 1.13.0 milestone Jun 8, 2020
a1012112796 and others added 2 commits June 9, 2020 01:06
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 12, 2020
@techknowlogick
Copy link
Member

ping LG-TM

@techknowlogick techknowlogick merged commit 48842ed into go-gitea:master Jun 13, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
…a#11761)

* 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 go-gitea#10959

Signed-off-by: a1012112796 <1012112796@qq.com>

* fix ui

* Fix ui, thanks to @silverwind.

Co-authored-by: silverwind <me@silverwind.io>

* fix lint

* Update templates/repo/issue/view_content/pull.tmpl

Co-authored-by: silverwind <me@silverwind.io>

* Apply review suggestion

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [UI] No Update-button on WIP pulls
7 participants