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. 2
      models/issue.go
  3. 4
      modules/bindata/bindata.go
  4. 2
      public/css/gogs.min.css
  5. 6
      public/less/_repository.less
  6. 3
      routers/repo/issue.go
  7. 3
      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.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

2
models/issue.go

@ -851,6 +851,7 @@ type PullRepo struct {
HeadRepoID int64 `xorm:"UNIQUE(s)"`
HeadRepo *Repository `xorm:"-"`
BaseRepoID int64 `xorm:"UNIQUE(s)"`
HeadUserName string
HeadBarcnh string `xorm:"UNIQUE(s)"`
BaseBranch string `xorm:"UNIQUE(s)"`
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.
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 {

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

6
public/less/_repository.less

@ -152,6 +152,11 @@
margin-top: 10px;
}
}
.pull-desc {
code {
color: #0166E6;
}
}
.pull {
&.tabular.menu {
margin-bottom: 10px;
@ -159,7 +164,6 @@
margin-right: 5px;
}
}
&.tab.segment {
border: none;
padding: 0;

3
routers/repo/issue.go

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

3
routers/repo/pull.go

@ -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
}
@ -353,6 +353,7 @@ func CompareAndPullRequestPost(ctx *middleware.Context, form auth.CreateIssueFor
if err := models.NewPullRequest(repo, pr, labelIDs, attachments, &models.PullRepo{
HeadRepoID: headRepo.ID,
BaseRepoID: repo.ID,
HeadUserName: headUser.Name,
HeadBarcnh: headBranch,
BaseBranch: baseBranch,
MergeBase: prInfo.MergeBase,

2
templates/repo/issue/view.tmpl

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

6
templates/repo/issue/view_title.tmpl

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