1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 09:13:10 +00:00

add view pull desc

This commit is contained in:
Unknwon 2015-09-01 19:26:39 -04:00
parent 8c046073a8
commit ebf1bd4f51
9 changed files with 43 additions and 28 deletions

View file

@ -464,6 +464,7 @@ pulls.compare_changes = Compare Changes
pulls.compare_changes_desc = Compare two branches and make a pull request for changes.
pulls.no_results = No results found.
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_commits = Commits
pulls.tab_files = Files changed

View file

@ -851,9 +851,10 @@ type PullRepo struct {
HeadRepoID int64 `xorm:"UNIQUE(s)"`
HeadRepo *Repository `xorm:"-"`
BaseRepoID int64 `xorm:"UNIQUE(s)"`
HeadBarcnh string `xorm:"UNIQUE(s)"`
BaseBranch string `xorm:"UNIQUE(s)"`
MergeBase string `xorm:"VARCHAR(40)"`
HeadUserName string
HeadBarcnh string `xorm:"UNIQUE(s)"`
BaseBranch string `xorm:"UNIQUE(s)"`
MergeBase string `xorm:"VARCHAR(40)"`
Type PullRequestType
CanAutoMerge bool
}
@ -871,7 +872,6 @@ func (pr *PullRepo) AfterSet(colName string, _ xorm.Cell) {
// 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) {
sess := x.NewSession()
defer sessionRelease(sess)
if err = sess.Begin(); err != nil {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -152,21 +152,25 @@
margin-top: 10px;
}
}
.pull-desc {
code {
color: #0166E6;
}
}
.pull {
&.tabular.menu {
margin-bottom: 10px;
.octicon {
margin-right: 5px;
}
}
&.tab.segment {
border: none;
padding: 0;
padding-top: 10px;
box-shadow: none;
background-color: inherit;
&.tabular.menu {
margin-bottom: 10px;
.octicon {
margin-right: 5px;
}
}
&.tab.segment {
border: none;
padding: 0;
padding-top: 10px;
box-shadow: none;
background-color: inherit;
}
}
.comment-list {
&:before {

View file

@ -461,6 +461,9 @@ func ViewIssue(ctx *middleware.Context) {
// Get more information if it's a pull request.
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()
if err != nil {
ctx.Handle(500, "PullRepo.HeadRepo.RepoPath", err)

View file

@ -314,7 +314,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
attachments []string
)
_, headRepo, headGitRepo, prInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
if ctx.Written() {
return
}
@ -351,12 +351,13 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
Content: form.Content,
}
if err := models.NewPullRequest(repo, pr, labelIDs, attachments, &models.PullRepo{
HeadRepoID: headRepo.ID,
BaseRepoID: repo.ID,
HeadBarcnh: headBranch,
BaseBranch: baseBranch,
MergeBase: prInfo.MergeBase,
Type: models.PULL_REQUEST_GOGS,
HeadRepoID: headRepo.ID,
BaseRepoID: repo.ID,
HeadUserName: headUser.Name,
HeadBarcnh: headBranch,
BaseBranch: baseBranch,
MergeBase: prInfo.MergeBase,
Type: models.PULL_REQUEST_GOGS,
}, patch); err != nil {
ctx.Handle(500, "NewPullRequest", err)
return

View file

@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="repository view issue">
<div class="repository view issue pull">
{{template "repo/header" .}}
<div class="ui container">
<div class="navbar">

View file

@ -21,6 +21,11 @@
{{else}}
<div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div>
{{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 }}
<span class="time-desc">
{{if gt .Issue.Poster.Id 0}}
@ -31,5 +36,6 @@
·
{{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}}
</span>
{{end}}
<div class="ui divider"></div>
</div>