mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 08:42:32 -05:00
920608e592
This PR changes the compare page to make the "..." in the between branches a clickable link. This changes the comparison type from "..." to "..". Similarly it makes the initial compare icon clickable to switch the head and base branches. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
217 lines
11 KiB
Handlebars
217 lines
11 KiB
Handlebars
{{template "base/head" .}}
|
|
<div class="page-content repository diff {{if .PageIsComparePull}}compare pull{{end}}">
|
|
{{template "repo/header" .}}
|
|
<div class="ui container {{if .IsSplitStyle}}fluid padded{{end}}">
|
|
|
|
<h2 class="ui header">
|
|
{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}}
|
|
{{.i18n.Tr "repo.pulls.compare_changes"}}
|
|
<div class="sub header">{{.i18n.Tr "repo.pulls.compare_changes_desc"}}</div>
|
|
{{ else }}
|
|
{{.i18n.Tr "action.compare_commits_general"}}
|
|
{{ end }}
|
|
</h2>
|
|
{{ $BaseCompareName := $.BaseName -}}
|
|
{{- $HeadCompareName := $.HeadRepo.OwnerName -}}
|
|
{{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}}
|
|
{{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}}
|
|
{{- end -}}
|
|
{{- $OwnForkCompareName := "" -}}
|
|
{{- if .OwnForkRepo -}}
|
|
{{- $OwnForkCompareName = .OwnForkRepo.OwnerName -}}
|
|
{{- end -}}
|
|
{{- $RootRepoCompareName := "" -}}
|
|
{{- if .RootRepo -}}
|
|
{{- $RootRepoCompareName = .RootRepo.OwnerName -}}
|
|
{{- 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/{{EscapePound $.HeadBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{$.BaseName}}/{{$.Repository.Name}}:{{end}}{{EscapePound $.BaseBranch}}" title="{{.i18n.Tr "repo.pulls.switch_head_and_base"}}">{{svg "octicon-git-compare"}}</a>
|
|
<div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">
|
|
<div class="ui basic small button">
|
|
<span class="text">{{if $.PageIsComparePull}}{{.i18n.Tr "repo.pulls.compare_base"}}{{else}}{{.i18n.Tr "repo.compare.compare_base"}}{{end}}: {{$BaseCompareName}}:{{$.BaseBranch}}</span>
|
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
|
</div>
|
|
<div class="menu">
|
|
<div class="ui icon search input">
|
|
<i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i>
|
|
<input name="search" placeholder="{{.i18n.Tr "repo.filter_branch_and_tag"}}...">
|
|
</div>
|
|
<div class="header">
|
|
<div class="ui grid">
|
|
<div class="two column row">
|
|
<a class="reference column" href="#" data-target=".base-branch-list">
|
|
<span class="text black">
|
|
{{svg "octicon-git-branch" 16 "mr-2"}}{{.i18n.Tr "repo.branches"}}
|
|
</span>
|
|
</a>
|
|
<a class="reference column" href="#" data-target=".base-tag-list">
|
|
<span class="text black">
|
|
{{svg "octicon-tag" 16 "mr-2"}}{{.i18n.Tr "repo.tags"}}
|
|
</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="scrolling menu reference-list-menu base-branch-list">
|
|
{{range .Branches}}
|
|
<div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound $.HeadBranch}}">{{$BaseCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{if not .PullRequestCtx.SameRepo}}
|
|
{{range .HeadBranches}}
|
|
<div class="item" data-url="{{$.HeadRepo.Link}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$HeadCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .OwnForkRepo}}
|
|
{{range .OwnForkRepoBranches}}
|
|
<div class="item" data-url="{{$.OwnForkRepo.Link}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$OwnForkCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .RootRepo}}
|
|
{{range .RootRepoBranches}}
|
|
<div class="item" data-url="{{$.RootRepo.Link}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$RootRepoCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
<div class="scrolling menu reference-list-menu base-tag-list" style="display: none">
|
|
{{range .Tags}}
|
|
<div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound $.HeadBranch}}">{{$BaseCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{if not .PullRequestCtx.SameRepo}}
|
|
{{range .HeadTags}}
|
|
<div class="item" data-url="{{$.HeadRepo.Link}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$HeadCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .OwnForkRepo}}
|
|
{{range .OwnForkRepoTags}}
|
|
<div class="item" data-url="{{$.OwnForkRepo.Link}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$OwnForkCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .RootRepo}}
|
|
{{range .RootRepoTags}}
|
|
<div class="item" data-url="{{$.RootRepo.Link}}/compare/{{EscapePound .}}{{$.CompareSeparator}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$RootRepoCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<a href="{{.RepoLink}}/compare/{{EscapePound .BaseBranch}}{{.OtherCompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound $.HeadBranch}}" title="{{.i18n.Tr "repo.pulls.switch_comparison_type"}}">{{.CompareSeparator}}</a>
|
|
<div class="ui floating filter dropdown">
|
|
<div class="ui basic small button">
|
|
<span class="text">{{if $.PageIsComparePull}}{{.i18n.Tr "repo.pulls.compare_compare"}}{{else}}{{.i18n.Tr "repo.compare.compare_head"}}{{end}}: {{$HeadCompareName}}:{{$.HeadBranch}}</span>
|
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
|
</div>
|
|
<div class="menu">
|
|
<div class="ui icon search input">
|
|
<i class="icon df ac jc m-0">{{svg "octicon-filter" 16}}</i>
|
|
<input name="search" placeholder="{{.i18n.Tr "repo.filter_branch_and_tag"}}...">
|
|
</div>
|
|
<div class="header">
|
|
<div class="ui grid">
|
|
<div class="two column row">
|
|
<a class="reference column" href="#" data-target=".head-branch-list">
|
|
<span class="text black">
|
|
{{svg "octicon-git-branch" 16 "mr-2"}}{{.i18n.Tr "repo.branches"}}
|
|
</span>
|
|
</a>
|
|
<a class="reference column" href="#" data-target=".head-tag-list">
|
|
<span class="text black">
|
|
{{svg "octicon-tag" 16 "mr-2"}}{{.i18n.Tr "repo.tags"}}
|
|
</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="scrolling menu reference-list-menu head-branch-list">
|
|
{{range .HeadBranches}}
|
|
<div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound .}}">{{$HeadCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{if not .PullRequestCtx.SameRepo}}
|
|
{{range .Branches}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{$.BaseName}}/{{$.Repository.Name}}:{{EscapePound .}}">{{$BaseCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .OwnForkRepo}}
|
|
{{range .OwnForkRepoBranches}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{$.OwnForkRepo.OwnerName}}/{{$.OwnForkRepo.Name}}:{{EscapePound .}}">{{$OwnForkCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .RootRepo}}
|
|
{{range .RootRepoBranches}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{$.RootRepo.OwnerName}}/{{$.RootRepo.Name}}:{{EscapePound .}}">{{$RootRepoCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
<div class="scrolling menu reference-list-menu head-tag-list" style="display: none">
|
|
{{range .HeadTags}}
|
|
<div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound .}}">{{$HeadCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{if not .PullRequestCtx.SameRepo}}
|
|
{{range .Tags}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{$.BaseName}}/{{$.Repository.Name}}:{{EscapePound .}}">{{$BaseCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .OwnForkRepo}}
|
|
{{range .OwnForkRepoTags}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{$.OwnForkRepo.OwnerName}}/{{$.OwnForkRepo.Name}}:{{EscapePound .}}">{{$OwnForkCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .RootRepo}}
|
|
{{range .RootRepoTags}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}{{$.CompareSeparator}}{{$.RootRepo.OwnerName}}/{{$.RootRepo.Name}}:{{EscapePound .}}">{{$RootRepoCompareName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{if .IsNothingToCompare}}
|
|
{{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) }}
|
|
<div class="ui segment">{{.i18n.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}</div>
|
|
<div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}}>
|
|
<button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button>
|
|
</div>
|
|
<div class="pullrequest-form" {{if not .Flash}}style="display: none"{{end}}>
|
|
{{template "repo/issue/new_form" .}}
|
|
</div>
|
|
{{else}}
|
|
<div class="ui segment">{{.i18n.Tr "repo.pulls.nothing_to_compare"}}</div>
|
|
{{end}}
|
|
{{else if and .PageIsComparePull (gt .CommitCount 0)}}
|
|
{{if .HasPullRequest}}
|
|
<div class="ui segment">
|
|
{{.i18n.Tr "repo.pulls.has_pull_request" $.RepoLink $.RepoRelPath .PullRequest.Index | Safe}}
|
|
</div>
|
|
{{else}}
|
|
{{if and $.IsSigned (not .Repository.IsArchived)}}
|
|
<div class="ui info message show-form-container" {{if .Flash}}style="display: none"{{end}}>
|
|
<button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button>
|
|
</div>
|
|
{{else if .Repository.IsArchived}}
|
|
<div class="ui warning message">
|
|
{{.i18n.Tr "repo.archive.title"}}
|
|
</div>
|
|
{{end}}
|
|
{{if $.IsSigned}}
|
|
<div class="pullrequest-form" {{if not .Flash}}style="display: none"{{end}}>
|
|
{{template "repo/issue/new_form" .}}
|
|
</div>
|
|
{{end}}
|
|
{{template "repo/commits_table" .}}
|
|
{{template "repo/diff/box" .}}
|
|
{{end}}
|
|
{{else}}
|
|
{{template "repo/commits_table" .}}
|
|
{{template "repo/diff/box" .}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{template "base/footer" .}}
|