diff options
author | Unknwon <u@gogs.io> | 2015-09-01 19:07:02 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-01 19:07:02 -0400 |
commit | 8c046073a891e3a192794869628763ef072002eb (patch) | |
tree | a5de325078531c330da64f8361d43184fee894d3 /templates | |
parent | 63fecac537298109253bc00c256336e942f73481 (diff) | |
download | gitea-8c046073a891e3a192794869628763ef072002eb.tar.gz gitea-8c046073a891e3a192794869628763ef072002eb.zip |
work on PR conversation
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/commits_table.tmpl | 11 | ||||
-rw-r--r-- | templates/repo/diff.tmpl | 93 | ||||
-rw-r--r-- | templates/repo/diff_box.tmpl | 92 | ||||
-rw-r--r-- | templates/repo/issue/view.tmpl | 24 | ||||
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 44 | ||||
-rw-r--r-- | templates/repo/issue/view_title.tmpl | 35 | ||||
-rw-r--r-- | templates/repo/pulls/compare.tmpl | 3 |
7 files changed, 168 insertions, 134 deletions
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 @@ </form> </div> {{else if .IsDiffCompare}} - <a href="{{$.RepoLink}}/commit/{{.BeforeCommitID}}" class="ui green sha label">{{ShortSha .BeforeCommitID}}</a> ... <a href="{{$.RepoLink}}/commit/{{.AfterCommitID}}" class="ui green sha label">{{ShortSha .AfterCommitID}}</a> + <a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID}}" class="ui green sha label">{{ShortSha .BeforeCommitID}}</a> ... <a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID}}" class="ui green sha label">{{ShortSha .AfterCommitID}}</a> {{end}} </h4> + +{{if .Commits}} <div class="ui attached table segment"> <table class="ui very basic striped commits table"> <thead> @@ -24,9 +26,7 @@ </tr> </thead> <tbody> - {{ $username := .Username}} - {{ $reponame := .Reponame}} - {{ $r:= List .Commits}} + {{ $r:= List .Commits}} {{range $r}} <tr> <td class="author"> @@ -36,7 +36,7 @@ <img class="ui avatar image" src="{{AvatarLink .Author.Email}}" alt=""/> {{.Author.Name}} {{end}} </td> - <td class="sha"><a rel="nofollow" class="ui green sha label" href="{{AppSubUrl}}/{{$username}}/{{$reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td> + <td class="sha"><a rel="nofollow" class="ui green sha label" href="{{AppSubUrl}}/{{$.Username}}/{{$.Reponame}}/commit/{{.Id}} ">{{SubStr .Id.String 0 10}} </a></td> <td class="message"><span class="text truncate">{{RenderCommitMessage .Summary $.RepoLink}}</span></td> <td class="date">{{TimeSince .Author.When $.Lang}}</td> </tr> @@ -44,6 +44,7 @@ </tbody> </table> </div> +{{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 @@ </div> {{end}} - {{if .DiffNotAvailable}} - <h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4> - {{else}} - <div class="diff-detail-box diff-box"> - <div> - <i class="fa fa-retweet"></i> - {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} - <div class="ui right"> - <a class="ui tiny basic black toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a> - </div> - </div> - <ol class="detail-files hide" id="diff-files"> - {{range .Diff.Files}} - <li> - <div class="diff-counter count pull-right"> - {{if not .IsBin}} - <span class="add" data-line="{{.Addition}}">{{.Addition}}</span> - <span class="bar"> - <span class="pull-left add"></span> - <span class="pull-left del"></span> - </span> - <span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span> - {{else}} - <span>{{$.i18n.Tr "repo.diff.bin"}}</span> - {{end}} - </div> - <!-- todo finish all file status, now modify, add, delete and rename --> - <span class="status {{DiffTypeToStr .Type}} poping up" data-content="{{DiffTypeToStr .Type}}" data-variation="inverted tiny" data-position="right center"> </span> - <a class="file" href="#diff-{{.Index}}">{{.Name}}</a> - </li> - {{end}} - </ol> - </div> - - {{range $i, $file := .Diff.Files}} - <div class="diff-file-box diff-box file-content" id="diff-{{.Index}}"> - <h4 class="ui top attached normal header"> - <div class="diff-counter count ui left"> - {{if not $file.IsBin}} - <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span> - <span class="bar"> - <span class="pull-left add"></span> - <span class="pull-left del"></span> - </span> - <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span> - {{else}} - {{$.i18n.Tr "repo.diff.bin"}} - {{end}} - </div> - <span class="file">{{$file.Name}}</span> - <div class="ui right"> - {{if $file.IsDeleted}} - <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> - {{else}} - <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> - {{end}} - </div> - </h4> - <div class="ui attached table segment"> - {{$isImage := (call $.IsImageFile $file.Name)}} - {{if $isImage}} - <div class="center"> - <img src="{{$.RawPath}}/{{EscapePound .Name}}"> - </div> - {{else}} - <div class="file-body file-code code-view code-diff"> - <table> - <tbody> - {{range .Sections}} - {{range $k, $line := .Lines}} - <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}"> - <td class="lines-num lines-num-old"> - <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span> - </td> - <td class="lines-num lines-num-new"> - <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span> - </td> - <td class="lines-code"> - <pre>{{$line.Content}}</pre> - </td> - </tr> - {{end}} - {{end}} - </tbody> - </table> - </div> - {{end}} - </div> - </div> - <br> - {{end}} - {{end}} + {{template "repo/diff_box" .}} </div> </div> {{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}} +<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4> +{{else}} +<div class="diff-detail-box diff-box"> + <div> + <i class="fa fa-retweet"></i> + {{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} + <div class="ui right"> + <a class="ui tiny basic black toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a> + </div> + </div> + <ol class="detail-files hide" id="diff-files"> + {{range .Diff.Files}} + <li> + <div class="diff-counter count pull-right"> + {{if not .IsBin}} + <span class="add" data-line="{{.Addition}}">{{.Addition}}</span> + <span class="bar"> + <span class="pull-left add"></span> + <span class="pull-left del"></span> + </span> + <span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span> + {{else}} + <span>{{$.i18n.Tr "repo.diff.bin"}}</span> + {{end}} + </div> + <!-- todo finish all file status, now modify, add, delete and rename --> + <span class="status {{DiffTypeToStr .Type}} poping up" data-content="{{DiffTypeToStr .Type}}" data-variation="inverted tiny" data-position="right center"> </span> + <a class="file" href="#diff-{{.Index}}">{{.Name}}</a> + </li> + {{end}} + </ol> +</div> + +{{range $i, $file := .Diff.Files}} +<div class="diff-file-box diff-box file-content" id="diff-{{.Index}}"> + <h4 class="ui top attached normal header"> + <div class="diff-counter count ui left"> + {{if not $file.IsBin}} + <span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span> + <span class="bar"> + <span class="pull-left add"></span> + <span class="pull-left del"></span> + </span> + <span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span> + {{else}} + {{$.i18n.Tr "repo.diff.bin"}} + {{end}} + </div> + <span class="file">{{$file.Name}}</span> + <div class="ui right"> + {{if $file.IsDeleted}} + <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> + {{else}} + <a class="ui basic tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a> + {{end}} + </div> + </h4> + <div class="ui attached table segment"> + {{$isImage := (call $.IsImageFile $file.Name)}} + {{if $isImage}} + <div class="center"> + <img src="{{$.RawPath}}/{{EscapePound .Name}}"> + </div> + {{else}} + <div class="file-body file-code code-view code-diff"> + <table> + <tbody> + {{range .Sections}} + {{range $k, $line := .Lines}} + <tr class="{{DiffLineTypeToStr .Type}}-code nl-{{$k}} ol-{{$k}}"> + <td class="lines-num lines-num-old"> + <span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}">{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}</span> + </td> + <td class="lines-num lines-num-new"> + <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span> + </td> + <td class="lines-code"> + <pre>{{$line.Content}}</pre> + </td> + </tr> + {{end}} + {{end}} + </tbody> + </table> + </div> + {{end}} + </div> +</div> +<br> +{{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 @@ </div> </div> <div class="ui divider"></div> + {{if .Issue.IsPull}} + {{template "repo/issue/view_title" .}} + <div class="ui top attached pull tabular menu"> + <a class="item active" href="{{.RepoLink}}/pulls/{{.Issue.Index}}"> + <span class="octicon octicon-comment-discussion"></span> + {{$.i18n.Tr "repo.pulls.tab_conversation"}} + <span class="ui label">{{.Issue.NumComments}}</span> + </a> + <a class="item" href="{{.RepoLink}}/pulls/{{.Issue.Index}}/commits"> + <span class="octicon octicon-git-commit"></span> + {{$.i18n.Tr "repo.pulls.tab_commits"}} + <span class="ui label">{{.NumCommits}}</span> + </a> + <a class="item" href="{{.RepoLink}}/pulls/{{.Issue.Index}}/files"> + <span class="octicon octicon-diff"></span> + {{$.i18n.Tr "repo.pulls.tab_files"}} + <span class="ui label">{{.NumFiles}}</span> + </a> + </div> + <div class="ui bottom attached tab pull segment active" data-tab="request-{{.ID}}"> + {{template "repo/issue/view_content" .}} + </div> + {{else}} {{template "repo/issue/view_content" .}} + {{end}} </div> </div> {{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" .}} </div> {{end}} - <div class="sixteen wide column title"> - <div class="ui grid"> - <h1 class="twelve wide column"> - <span class="index">#{{.Issue.Index}}</span> <span id="issue-title">{{.Issue.Name}}</span> - <div id="edit-title-input" class="ui input" style="display: none"> - <input value="{{.Issue.Name}}"> - </div> - </h1> - {{if .IsIssueOwner}} - <div class="four wide column"> - <div class="edit-zone text right"> - <div id="edit-title" class="ui basic green not-in-edit button">{{.i18n.Tr "repo.issues.edit"}}</div> - <div id="cancel-edit-title" class="ui basic blue in-edit button" style="display: none">{{.i18n.Tr "repo.issues.cancel"}}</div> - <div id="save-edit-title" class="ui green in-edit button" style="display: none" data-update-url="{{.Link}}/title">{{.i18n.Tr "repo.issues.save"}}</div> - </div> - </div> - {{end}} - </div> - {{if .Issue.IsClosed}} - <div class="ui red large label"><i class="octicon octicon-issue-closed"></i> {{.i18n.Tr "repo.issues.closed_title"}}</div> - {{else}} - <div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div> - {{end}} - {{ $createdStr:= TimeSince .Issue.Created $.Lang }} - <span class="time-desc"> - {{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}} - </span> - <div class="ui divider"></div> - </div> + {{if not .Issue.IsPull}} + {{template "repo/issue/view_title" .}} + {{end}} + + {{ $createdStr:= TimeSince .Issue.Created $.Lang }} <div class="twelve wide column comment-list"> <ui class="ui comments"> <div class="comment"> @@ -63,7 +33,7 @@ {{end}} </div> <div class="raw-content hide">{{.Issue.Content}}</div> - <div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{.Link}}/content" data-context="{{.RepoLink}}"></div> + <div class="edit-content-zone hide" data-write="issue-{{.Issue.ID}}-write" data-preview="issue-{{.Issue.ID}}-preview" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/content" data-context="{{.RepoLink}}"></div> </div> {{if .Issue.Attachments}} <div class="ui bottom attached segment"> @@ -167,7 +137,7 @@ <img src="{{.SignedUser.AvatarLink}}"> </a> <div class="content"> - <form class="ui segment form" id="comment-form" action="{{.Link}}/comments" method="post"> + <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post"> {{template "repo/issue/comment_tab" .}} {{.CsrfTokenHtml}} <input id="status" name="status" type="hidden"> 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 @@ +<div class="sixteen wide column title"> + <div class="ui grid"> + <h1 class="twelve wide column"> + <span class="index">#{{.Issue.Index}}</span> <span id="issue-title">{{.Issue.Name}}</span> + <div id="edit-title-input" class="ui input" style="display: none"> + <input value="{{.Issue.Name}}"> + </div> + </h1> + {{if .IsIssueOwner}} + <div class="four wide column"> + <div class="edit-zone text right"> + <div id="edit-title" class="ui basic green not-in-edit button">{{.i18n.Tr "repo.issues.edit"}}</div> + <div id="cancel-edit-title" class="ui basic blue in-edit button" style="display: none">{{.i18n.Tr "repo.issues.cancel"}}</div> + <div id="save-edit-title" class="ui green in-edit button" style="display: none" data-update-url="{{$.RepoLink}}/issues/{{.Issue.Index}}/title">{{.i18n.Tr "repo.issues.save"}}</div> + </div> + </div> + {{end}} + </div> + {{if .Issue.IsClosed}} + <div class="ui red large label"><i class="octicon octicon-issue-closed"></i> {{.i18n.Tr "repo.issues.closed_title"}}</div> + {{else}} + <div class="ui green large label"><i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues.open_title"}}</div> + {{end}} + {{ $createdStr:= TimeSince .Issue.Created $.Lang }} + <span class="time-desc"> + {{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}} + </span> + <div class="ui divider"></div> +</div>
\ 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 @@ </div> </div> {{template "repo/issue/new_form" .}} + + {{template "repo/commits_table" .}} + {{template "repo/diff_box" .}} </div> </div> |