From 8c046073a891e3a192794869628763ef072002eb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 1 Sep 2015 19:07:02 -0400 Subject: work on PR conversation --- templates/repo/commits_table.tmpl | 11 ++-- templates/repo/diff.tmpl | 93 +--------------------------------- templates/repo/diff_box.tmpl | 92 +++++++++++++++++++++++++++++++++ templates/repo/issue/view.tmpl | 24 +++++++++ templates/repo/issue/view_content.tmpl | 44 +++------------- templates/repo/issue/view_title.tmpl | 35 +++++++++++++ templates/repo/pulls/compare.tmpl | 3 ++ 7 files changed, 168 insertions(+), 134 deletions(-) create mode 100644 templates/repo/diff_box.tmpl create mode 100644 templates/repo/issue/view_title.tmpl (limited to 'templates/repo') diff --git a/templates/repo/commits_table.tmpl b/templates/repo/commits_table.tmpl index 56ec2da375..a077af0b78 100644 --- a/templates/repo/commits_table.tmpl +++ b/templates/repo/commits_table.tmpl @@ -10,9 +10,11 @@ {{else if .IsDiffCompare}} - {{ShortSha .BeforeCommitID}} ... {{ShortSha .AfterCommitID}} + {{ShortSha .BeforeCommitID}} ... {{ShortSha .AfterCommitID}} {{end}} + +{{if .Commits}}
@@ -24,9 +26,7 @@ - {{ $username := .Username}} - {{ $reponame := .Reponame}} - {{ $r:= List .Commits}} + {{ $r:= List .Commits}} {{range $r}} - + @@ -44,6 +44,7 @@
@@ -36,7 +36,7 @@   {{.Author.Name}} {{end}} {{SubStr .Id.String 0 10}} {{SubStr .Id.String 0 10}} {{RenderCommitMessage .Summary $.RepoLink}} {{TimeSince .Author.When $.Lang}}
+{{end}} {{with .Page}} {{if gt .TotalPages 1}} diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 932a109e42..a280c81e17 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -41,98 +41,7 @@ {{end}} - {{if .DiffNotAvailable}} -

{{.i18n.Tr "repo.diff.data_not_available"}}

- {{else}} -
-
- - {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} - -
-
    - {{range .Diff.Files}} -
  1. -
    - {{if not .IsBin}} - {{.Addition}} - - - - - {{.Deletion}} - {{else}} - {{$.i18n.Tr "repo.diff.bin"}} - {{end}} -
    - -   - {{.Name}} -
  2. - {{end}} -
-
- - {{range $i, $file := .Diff.Files}} -
-

-
- {{if not $file.IsBin}} - + {{.Addition}} - - - - - - {{.Deletion}} - {{else}} - {{$.i18n.Tr "repo.diff.bin"}} - {{end}} -
- {{$file.Name}} -
- {{if $file.IsDeleted}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{else}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{end}} -
-

-
- {{$isImage := (call $.IsImageFile $file.Name)}} - {{if $isImage}} -
- -
- {{else}} -
- - - {{range .Sections}} - {{range $k, $line := .Lines}} - - - - - - {{end}} - {{end}} - -
- {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - - {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} - -
{{$line.Content}}
-
-
- {{end}} -
-
-
- {{end}} - {{end}} + {{template "repo/diff_box" .}} {{template "base/footer" .}} diff --git a/templates/repo/diff_box.tmpl b/templates/repo/diff_box.tmpl new file mode 100644 index 0000000000..f4509942ec --- /dev/null +++ b/templates/repo/diff_box.tmpl @@ -0,0 +1,92 @@ +{{if .DiffNotAvailable}} +

{{.i18n.Tr "repo.diff.data_not_available"}}

+{{else}} +
+
+ + {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} + +
+
    + {{range .Diff.Files}} +
  1. +
    + {{if not .IsBin}} + {{.Addition}} + + + + + {{.Deletion}} + {{else}} + {{$.i18n.Tr "repo.diff.bin"}} + {{end}} +
    + +   + {{.Name}} +
  2. + {{end}} +
+
+ +{{range $i, $file := .Diff.Files}} +
+

+
+ {{if not $file.IsBin}} + + {{.Addition}} + + + + + - {{.Deletion}} + {{else}} + {{$.i18n.Tr "repo.diff.bin"}} + {{end}} +
+ {{$file.Name}} +
+ {{if $file.IsDeleted}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{else}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{end}} +
+

+
+ {{$isImage := (call $.IsImageFile $file.Name)}} + {{if $isImage}} +
+ +
+ {{else}} +
+ + + {{range .Sections}} + {{range $k, $line := .Lines}} + + + + + + {{end}} + {{end}} + +
+ {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} + + {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} + +
{{$line.Content}}
+
+
+ {{end}} +
+
+
+{{end}} +{{end}} \ No newline at end of file diff --git a/templates/repo/issue/view.tmpl b/templates/repo/issue/view.tmpl index 129bfd0859..b7ec0152f5 100644 --- a/templates/repo/issue/view.tmpl +++ b/templates/repo/issue/view.tmpl @@ -9,7 +9,31 @@
+ {{if .Issue.IsPull}} + {{template "repo/issue/view_title" .}} + +
+ {{template "repo/issue/view_content" .}} +
+ {{else}} {{template "repo/issue/view_content" .}} + {{end}} {{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index a6d4ba4712..4ed7240d36 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -4,41 +4,11 @@ {{template "base/alert" .}} {{end}} -
-
-

- #{{.Issue.Index}} {{.Issue.Name}} - -

- {{if .IsIssueOwner}} -
-
-
{{.i18n.Tr "repo.issues.edit"}}
- - -
-
- {{end}} -
- {{if .Issue.IsClosed}} -
{{.i18n.Tr "repo.issues.closed_title"}}
- {{else}} -
{{.i18n.Tr "repo.issues.open_title"}}
- {{end}} - {{ $createdStr:= TimeSince .Issue.Created $.Lang }} - - {{if gt .Issue.Poster.Id 0}} - {{$.i18n.Tr "repo.issues.opened_by" $createdStr .Issue.Poster.HomeLink .Issue.Poster.Name | Safe}} - {{else}} - {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr .Issue.Poster.Name | Safe}} - {{end}} - · - {{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}} - -
-
+ {{if not .Issue.IsPull}} + {{template "repo/issue/view_title" .}} + {{end}} + + {{ $createdStr:= TimeSince .Issue.Created $.Lang }}
@@ -63,7 +33,7 @@ {{end}}
{{.Issue.Content}}
-
+
{{if .Issue.Attachments}}
@@ -167,7 +137,7 @@
-
+ {{template "repo/issue/comment_tab" .}} {{.CsrfTokenHtml}} diff --git a/templates/repo/issue/view_title.tmpl b/templates/repo/issue/view_title.tmpl new file mode 100644 index 0000000000..6b8e1c55a4 --- /dev/null +++ b/templates/repo/issue/view_title.tmpl @@ -0,0 +1,35 @@ +
+
+

+ #{{.Issue.Index}} {{.Issue.Name}} + +

+ {{if .IsIssueOwner}} +
+
+
{{.i18n.Tr "repo.issues.edit"}}
+ + +
+
+ {{end}} +
+ {{if .Issue.IsClosed}} +
{{.i18n.Tr "repo.issues.closed_title"}}
+ {{else}} +
{{.i18n.Tr "repo.issues.open_title"}}
+ {{end}} + {{ $createdStr:= TimeSince .Issue.Created $.Lang }} + + {{if gt .Issue.Poster.Id 0}} + {{$.i18n.Tr "repo.issues.opened_by" $createdStr .Issue.Poster.HomeLink .Issue.Poster.Name | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.opened_by_fake" $createdStr .Issue.Poster.Name | Safe}} + {{end}} + · + {{$.i18n.Tr "repo.issues.num_comments" .Issue.NumComments}} + +
+
\ No newline at end of file diff --git a/templates/repo/pulls/compare.tmpl b/templates/repo/pulls/compare.tmpl index 907a25b6cf..219fe3a4e1 100644 --- a/templates/repo/pulls/compare.tmpl +++ b/templates/repo/pulls/compare.tmpl @@ -46,6 +46,9 @@
{{template "repo/issue/new_form" .}} + + {{template "repo/commits_table" .}} + {{template "repo/diff_box" .}} -- cgit v1.2.3