mirror of
https://github.com/go-gitea/gitea
synced 2024-11-18 08:04:25 +00:00
38cd9ba47b
* routers: make /compare route available to unauthenticated users Remove some bits of the compare interface if the user isn't signed in. Notably, they don't need to see the "New Pull Request" button box nor the hidden form that would fail to submit due to the POST request continuing to require proper privileges. Follow-up commits will improve the UI a bit around this, removing some "Pull Request" verbiage in favor of "Compare." * ui: home: show "compare" button for unauthenticated users This change requires pulling in the BaseRepo unconditionally and recording if the pull request is in-fact not allowed (.PullRequestCtx.Allowed). If the user isn't allowed to create a pull request, either because this isn't a fork or same-fork branch PRs aren't allowed, then we'll name the button "Compare" instead of "Pull Request." * ui: branch list: use the new Compare language when available When viewing the branch listing as an unauthenticated user, you'll get "Pull Request" buttons. use the new "Compare" verbiage instead, which matches GitHub behavior when you can't issue a pull request from the branches. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
92 lines
3.5 KiB
Cheetah
92 lines
3.5 KiB
Cheetah
{{template "base/head" .}}
|
|
<div class="repository diff {{if .PageIsComparePull}}compare pull{{end}}">
|
|
{{template "repo/header" .}}
|
|
<div class="ui container {{if .IsSplitStyle}}fluid padded{{end}}">
|
|
|
|
{{if .PageIsComparePull}}
|
|
<h2 class="ui header">
|
|
{{if and $.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>
|
|
<div class="ui segment choose branch">
|
|
{{svg "octicon-git-compare" 16}}
|
|
<div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">
|
|
<div class="ui basic small button">
|
|
<span class="text">{{.i18n.Tr "repo.pulls.compare_base"}}: {{$.BaseName}}:{{$.BaseBranch}}</span>
|
|
<i class="dropdown icon"></i>
|
|
</div>
|
|
<div class="menu">
|
|
<div class="ui icon search input">
|
|
<i class="filter icon"></i>
|
|
<input name="search" placeholder="{{.i18n.Tr "repo.pulls.filter_branch"}}...">
|
|
</div>
|
|
<div class="scrolling menu">
|
|
{{range .Branches}}
|
|
<div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{EscapePound .}}...{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}:{{end}}{{EscapePound $.HeadBranch}}">{{$.BaseName}}:{{.}}</div>
|
|
{{end}}
|
|
{{if .Repository.IsFork}}
|
|
{{range .BaseRepoBranches}}
|
|
<div class="item" data-url="{{$.PullRequestCtx.BaseRepo.Link}}/compare/{{EscapePound .}}...{{$.HeadUser.Name}}:{{EscapePound $.HeadBranch}}">{{$.PullRequestCtx.BaseRepo.OwnerName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
...
|
|
<div class="ui floating filter dropdown">
|
|
<div class="ui basic small button">
|
|
<span class="text">{{.i18n.Tr "repo.pulls.compare_compare"}}: {{$.HeadUser.Name}}:{{$.HeadBranch}}</span>
|
|
<i class="dropdown icon"></i>
|
|
</div>
|
|
<div class="menu">
|
|
<div class="ui icon search input">
|
|
<i class="filter icon"></i>
|
|
<input name="search" placeholder="{{.i18n.Tr "repo.pulls.filter_branch"}}...">
|
|
</div>
|
|
<div class="scrolling menu">
|
|
{{range .HeadBranches}}
|
|
<div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}...{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}:{{end}}{{EscapePound .}}">{{$.HeadUser.Name}}:{{.}}</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .IsNothingToCompare}}
|
|
<div class="ui segment">{{.i18n.Tr "repo.pulls.nothing_to_compare"}}</div>
|
|
{{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">
|
|
<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" style="display: none">
|
|
{{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" .}}
|