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

Make diff view full width again #24598

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{if .DiffNotAvailable}}
<div class="diff-detail-box diff-box sticky">
<div>
<div>
<div class="diff-detail-box diff-box sticky">
<div class="ui right">
{{template "repo/diff/whitespace_dropdown" .}}
{{template "repo/diff/options_dropdown" .}}
Expand Down
27 changes: 15 additions & 12 deletions templates/repo/diff/compare.tmpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository diff {{if .PageIsComparePull}}compare pull{{end}}">
{{template "repo/header" .}}
<div class="ui container fluid padded">
Copy link
Contributor

@HesterG HesterG May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just found that for this page, the widths of containers are different now, maybe we should still keep the fluid padded classes here (need to open another PR if this should be added back)?

Screen Shot 2023-05-10 at 10 19 03

Copy link
Contributor Author

@wxiaoguang wxiaoguang May 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's done by purpose: "And this PR also make the "create new PR form" not that wide"

Otherwise the "form" will be too wide.

ps: I agree that the UI doesn't look good, but it didn't look good before either ...

So, it needs some better designs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github does not use wider width for these pages(diff and new pr), maybe we can do the same? remove the fluid on these two pages.

dff page:
Screen Shot 2023-05-10 at 10 35 39

new pr page:
Screen Shot 2023-05-10 at 10 37 04
Screen Shot 2023-05-10 at 10 35 53

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, then we can make this page narrow.


{{$showDiffBox := false}}
<div class="ui container">
<h2 class="ui header">
{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}}
{{.locale.Tr "repo.pulls.compare_changes"}}
Expand Down Expand Up @@ -34,11 +34,6 @@
{{- if eq $.HeadRepo.OwnerName .RootRepo.OwnerName -}}
{{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}}
{{- end -}}
{{- if .OwnForkRepo -}}
{{- if eq $.OwnForkRepo.OwnerName .RootRepo.OwnerName -}}
{{- $OwnForkRepoCompareName = printf "%s/%s" $.OwnForkRepo.OwnerName $.OwnForkRepo.Name -}}
{{- end -}}
{{- end -}}
{{- end -}}
<div class="ui segment choose branch">
<a href="{{$.HeadRepo.Link}}/compare/{{PathEscapeSegments $.HeadBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{PathEscape $.BaseName}}/{{PathEscape $.Repository.Name}}:{{end}}{{PathEscapeSegments $.BaseBranch}}" title="{{.locale.Tr "repo.pulls.switch_head_and_base"}}">{{svg "octicon-git-compare"}}</a>
Expand Down Expand Up @@ -203,14 +198,15 @@
<span class="index">#{{.PullRequest.Issue.Index}}</span>
</h1>
</div>
<div class="four wide right middle aligned column">
<div class="four wide column middle aligned text right">
{{- if .PullRequest.HasMerged -}}
<a href="{{Escape $.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button purple show-form">{{svg "octicon-git-merge" 16}} {{.locale.Tr "repo.pulls.view"}}</a>
{{else if .Issue.IsClosed}}
<a href="{{Escape $.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button red show-form">{{svg "octicon-issue-closed" 16}} {{.locale.Tr "repo.pulls.view"}}</a>
{{else}}
<a href="{{Escape $.RepoLink}}/pulls/{{.PullRequest.Issue.Index}}" class="ui button green show-form">{{svg "octicon-git-pull-request" 16}} {{.locale.Tr "repo.pulls.view"}}</a>
{{end}}</div>
{{end}}
</div>
</div>
{{else}}
{{if and $.IsSigned (not .Repository.IsArchived)}}
Expand All @@ -231,13 +227,20 @@
{{template "repo/issue/new_form" .}}
</div>
{{end}}
{{template "repo/commits_table" .}}
{{template "repo/diff/box" .}}
{{$showDiffBox = true}}
{{end}}
{{else}}
{{$showDiffBox = true}}
{{end}}
</div>

{{if $showDiffBox}}
<div class="ui container">
{{template "repo/commits_table" .}}
</div>
<div class="ui container fluid padded">
{{template "repo/diff/box" .}}
{{end}}
</div>
{{end}}
</div>
{{template "base/footer" .}}
2 changes: 1 addition & 1 deletion templates/repo/pulls/files.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<div role="main" aria-label="{{.Title}}" class="page-content repository view issue pull files diff">
{{template "repo/header" .}}
<div class="ui container">
<div class="ui container fluid padded">
{{template "repo/issue/view_title" .}}
{{template "repo/pulls/tab_menu" .}}
{{template "repo/diff/box" .}}
Expand Down