Browse Source

add view pull desc

pull/1524/merge
Unknwon 9 years ago
parent
commit
ebf1bd4f51
  1. 1
      conf/locale/locale_en-US.ini
  2. 8
      models/issue.go
  3. 4
      modules/bindata/bindata.go
  4. 2
      public/css/gogs.min.css
  5. 30
      public/less/_repository.less
  6. 3
      routers/repo/issue.go
  7. 15
      routers/repo/pull.go
  8. 2
      templates/repo/issue/view.tmpl
  9. 6
      templates/repo/issue/view_title.tmpl

1
conf/locale/locale_en-US.ini

@ -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

8
models/issue.go

@ -851,9 +851,10 @@ 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)"`
HeadBarcnh string `xorm:"UNIQUE(s)"` HeadUserName string
BaseBranch string `xorm:"UNIQUE(s)"` HeadBarcnh string `xorm:"UNIQUE(s)"`
MergeBase string `xorm:"VARCHAR(40)"` BaseBranch string `xorm:"UNIQUE(s)"`
MergeBase string `xorm:"VARCHAR(40)"`
Type PullRequestType Type PullRequestType
CanAutoMerge bool CanAutoMerge bool
} }
@ -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 {

4
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

2
public/css/gogs.min.css vendored

File diff suppressed because one or more lines are too long

30
public/less/_repository.less

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

3
routers/repo/issue.go

@ -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)

15
routers/repo/pull.go

@ -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
} }
@ -351,12 +351,13 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
Content: form.Content, Content: form.Content,
} }
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,
HeadBarcnh: headBranch, HeadUserName: headUser.Name,
BaseBranch: baseBranch, HeadBarcnh: headBranch,
MergeBase: prInfo.MergeBase, BaseBranch: baseBranch,
Type: models.PULL_REQUEST_GOGS, MergeBase: prInfo.MergeBase,
Type: models.PULL_REQUEST_GOGS,
}, patch); err != nil { }, patch); err != nil {
ctx.Handle(500, "NewPullRequest", err) ctx.Handle(500, "NewPullRequest", err)
return return

2
templates/repo/issue/view.tmpl

@ -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">

6
templates/repo/issue/view_title.tmpl

@ -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…
Cancel
Save