Browse Source

add view pull desc

Unknwon 9 năm trước cách đây
mục cha
commit
ebf1bd4f51

+ 1 - 0
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

+ 4 - 4
models/issue.go

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

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
modules/bindata/bindata.go


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
public/css/gogs.min.css


+ 17 - 13
public/less/_repository.less

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

+ 3 - 0
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)

+ 8 - 7
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
 	}
@@ -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

+ 1 - 1
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 - 0
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>

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác