mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-25 07:43:36 +01:00
add view pull desc
This commit is contained in:
parent
8c046073a8
commit
ebf1bd4f51
9 changed files with 43 additions and 28 deletions
|
@ -464,6 +464,7 @@ pulls.compare_changes = Compare Changes
|
||||||
pulls.compare_changes_desc = Compare two branches and make a pull request for changes.
|
pulls.compare_changes_desc = Compare two branches and make a pull request for changes.
|
||||||
pulls.no_results = No results found.
|
pulls.no_results = No results found.
|
||||||
pulls.create = Create Pull Request
|
pulls.create = Create Pull Request
|
||||||
|
pulls.title_desc = wants to merge %[1]d commits from <code>%[2]s</code> into <code>%[3]s</code>
|
||||||
pulls.tab_conversation = Conversation
|
pulls.tab_conversation = Conversation
|
||||||
pulls.tab_commits = Commits
|
pulls.tab_commits = Commits
|
||||||
pulls.tab_files = Files changed
|
pulls.tab_files = Files changed
|
||||||
|
|
|
@ -851,6 +851,7 @@ type PullRepo struct {
|
||||||
HeadRepoID int64 `xorm:"UNIQUE(s)"`
|
HeadRepoID int64 `xorm:"UNIQUE(s)"`
|
||||||
HeadRepo *Repository `xorm:"-"`
|
HeadRepo *Repository `xorm:"-"`
|
||||||
BaseRepoID int64 `xorm:"UNIQUE(s)"`
|
BaseRepoID int64 `xorm:"UNIQUE(s)"`
|
||||||
|
HeadUserName string
|
||||||
HeadBarcnh string `xorm:"UNIQUE(s)"`
|
HeadBarcnh string `xorm:"UNIQUE(s)"`
|
||||||
BaseBranch string `xorm:"UNIQUE(s)"`
|
BaseBranch string `xorm:"UNIQUE(s)"`
|
||||||
MergeBase string `xorm:"VARCHAR(40)"`
|
MergeBase string `xorm:"VARCHAR(40)"`
|
||||||
|
@ -871,7 +872,6 @@ func (pr *PullRepo) AfterSet(colName string, _ xorm.Cell) {
|
||||||
|
|
||||||
// NewPullRequest creates new pull request with labels for repository.
|
// NewPullRequest creates new pull request with labels for repository.
|
||||||
func NewPullRequest(repo *Repository, pr *Issue, labelIDs []int64, uuids []string, pullRepo *PullRepo, patch []byte) (err error) {
|
func NewPullRequest(repo *Repository, pr *Issue, labelIDs []int64, uuids []string, pullRepo *PullRepo, patch []byte) (err error) {
|
||||||
|
|
||||||
sess := x.NewSession()
|
sess := x.NewSession()
|
||||||
defer sessionRelease(sess)
|
defer sessionRelease(sess)
|
||||||
if err = sess.Begin(); err != nil {
|
if err = sess.Begin(); err != nil {
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
public/css/gogs.min.css
vendored
2
public/css/gogs.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -152,6 +152,11 @@
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.pull-desc {
|
||||||
|
code {
|
||||||
|
color: #0166E6;
|
||||||
|
}
|
||||||
|
}
|
||||||
.pull {
|
.pull {
|
||||||
&.tabular.menu {
|
&.tabular.menu {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
@ -159,7 +164,6 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tab.segment {
|
&.tab.segment {
|
||||||
border: none;
|
border: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
|
@ -461,6 +461,9 @@ func ViewIssue(ctx *middleware.Context) {
|
||||||
|
|
||||||
// Get more information if it's a pull request.
|
// Get more information if it's a pull request.
|
||||||
if issue.IsPull {
|
if issue.IsPull {
|
||||||
|
ctx.Data["HeadTarget"] = issue.PullRepo.HeadUserName + "/" + issue.PullRepo.HeadBarcnh
|
||||||
|
ctx.Data["BaseTarget"] = ctx.Repo.Owner.Name + "/" + issue.PullRepo.BaseBranch
|
||||||
|
|
||||||
headRepoPath, err := issue.PullRepo.HeadRepo.RepoPath()
|
headRepoPath, err := issue.PullRepo.HeadRepo.RepoPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Handle(500, "PullRepo.HeadRepo.RepoPath", err)
|
ctx.Handle(500, "PullRepo.HeadRepo.RepoPath", err)
|
||||||
|
|
|
@ -314,7 +314,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
||||||
attachments []string
|
attachments []string
|
||||||
)
|
)
|
||||||
|
|
||||||
_, headRepo, headGitRepo, prInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
|
headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
|
||||||
if ctx.Written() {
|
if ctx.Written() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
|
||||||
if err := models.NewPullRequest(repo, pr, labelIDs, attachments, &models.PullRepo{
|
if err := models.NewPullRequest(repo, pr, labelIDs, attachments, &models.PullRepo{
|
||||||
HeadRepoID: headRepo.ID,
|
HeadRepoID: headRepo.ID,
|
||||||
BaseRepoID: repo.ID,
|
BaseRepoID: repo.ID,
|
||||||
|
HeadUserName: headUser.Name,
|
||||||
HeadBarcnh: headBranch,
|
HeadBarcnh: headBranch,
|
||||||
BaseBranch: baseBranch,
|
BaseBranch: baseBranch,
|
||||||
MergeBase: prInfo.MergeBase,
|
MergeBase: prInfo.MergeBase,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{template "base/head" .}}
|
{{template "base/head" .}}
|
||||||
<div class="repository view issue">
|
<div class="repository view issue pull">
|
||||||
{{template "repo/header" .}}
|
{{template "repo/header" .}}
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div>
|
<div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
{{if .Issue.IsPull}}
|
||||||
|
<a {{if gt .Issue.Poster.Id 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>{{.Issue.Poster.Name}}</a>
|
||||||
|
<span class="pull-desc">{{$.i18n.Tr "repo.pulls.title_desc" .NumCommits .HeadTarget .BaseTarget | Str2html}}</span>
|
||||||
|
{{else}}
|
||||||
{{ $createdStr:= TimeSince .Issue.Created $.Lang }}
|
{{ $createdStr:= TimeSince .Issue.Created $.Lang }}
|
||||||
<span class="time-desc">
|
<span class="time-desc">
|
||||||
{{if gt .Issue.Poster.Id 0}}
|
{{if gt .Issue.Poster.Id 0}}
|
||||||
|
@ -31,5 +36,6 @@
|
||||||
·
|
·
|
||||||
{{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}}
|
{{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}}
|
||||||
</span>
|
</span>
|
||||||
|
{{end}}
|
||||||
<div class="ui divider"></div>
|
<div class="ui divider"></div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in a new issue