diff options
author | Lauris BH <lauris@nix.lv> | 2018-08-06 07:43:22 +0300 |
---|---|---|
committer | Jonas Franz <info@jonasfranz.software> | 2018-08-06 06:43:21 +0200 |
commit | 6e64f9db8eb889f9cc7e8c9576b2f9c89750927e (patch) | |
tree | d76b927295a1d2f69ea73a78e83d9264ce1510f2 /templates | |
parent | 9c354a539ab498ebfdebf7395cf17f95f8b24ac8 (diff) | |
download | gitea-6e64f9db8eb889f9cc7e8c9576b2f9c89750927e.tar.gz gitea-6e64f9db8eb889f9cc7e8c9576b2f9c89750927e.zip |
Pull request review/approval and comment on code (#3748)
* Initial ui components for pull request review
* Add Review
Add IssueComment types
Signed-off-by: Jonas Franz <info@jonasfranz.software>
(cherry picked from commit 2b4daab)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Replace ReviewComment with Content
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add load functions
Add ReviewID to findComments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add create review comment implementation
Add migration for review
Other small changes
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Simplified create and find functions for review
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Moved "Pending" to first position
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add GetCurrentReview to simplify fetching current review
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Preview for listing comments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Move new comment form to its own file
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Implement Review form
Show Review comments on comment stream
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add support for single comments
Showing buttons in context
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add pending tag to pending review comments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add unit tests for Review
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fetch all review ids at once
Add unit tests
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* gofmt
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Improved comment rendering in "Files" view by adding Comments to DiffLine
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add support for invalidating comments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Switched back to code.gitea.io/git
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Moved review migration from v64 to v65
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Rebuild css
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* gofmt
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Improve translations
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix unit tests by updating fixtures and updating outdated test
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Comments will be shown at the right place now
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add support for deleting CodeComments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix problems caused by files in subdirectories
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add support for showing code comments of reviews in conversation
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add support for "Show/Hide outdated"
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Update code.gitea.io/git
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add support for new webhooks
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Update comparison
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Resolve conflicts
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Minor UI improvements
* update code.gitea.io/git
* Fix ui bug reported by @lunny causing wrong position of add button
Add functionality to "Cancel" button
Add scale effects to add button
Hide "Cancel" button for existing comments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Prepare solving conflicts
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Show add button only if no comments already exist for the line
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add missing vendor files
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Check if reviewer is nil
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Show forms only to users who are logged in
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Revert "Show forms only to users who are logged in"
This reverts commit c083682
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Save patch in comment
Render patch for code comments
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add link to comment in code
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add reply form to comment list
Show forms only to signed in users
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add 'Reply' as translatable
Add CODE_COMMENT_LINES setting
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* gofmt
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix problems introduced by checking for singed in user
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add v70
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Update generated stylesheet
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix preview
Beginn with new review comment patch system
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add new algo to generate diff for line range
Remove old algo used for cutting big diffs (it was very buggy)
* Add documentation and example for CutDiffAroundLine
* Fix example of CutDiffAroundLine
* Fix some comment UI rendering bugs
* Add code comment edit mode
* Send notifications / actions to users until review gets published
Fix diff generation bug
Fix wrong hashtag
* Fix vet errors
* Send notifications also for single comments
* Fix some notification bugs, fix link
* Fix: add comment icon is only shown on code lines
* Add lint comment
* Add unit tests for git diff
* Add more error messages
* Regenerated css
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* fmt
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Regenerated CSS with latest less version
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix test by updating comment type to new ID
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Introducing CodeComments as type for map[string]map[int64][]*Comment
Other minor code improvements
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Fix data-tab issues
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Remove unnecessary change
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* refactored checkForInvalidation
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Append comments instead of setting
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Use HeadRepo instead of BaseRepo
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Update migration
Signed-off-by: Jonas Franz <info@jonasfranz.de>
* Regenerated CSS
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Add copyright
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Update index.css
Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/repo/diff/box.tmpl | 71 | ||||
-rw-r--r-- | templates/repo/diff/comment_form.tmpl | 45 | ||||
-rw-r--r-- | templates/repo/diff/comment_form_datahandler.tmpl | 7 | ||||
-rw-r--r-- | templates/repo/diff/comments.tmpl | 51 | ||||
-rw-r--r-- | templates/repo/diff/new_comment.tmpl | 3 | ||||
-rw-r--r-- | templates/repo/diff/new_review.tmpl | 28 | ||||
-rw-r--r-- | templates/repo/diff/section_unified.tmpl | 24 | ||||
-rw-r--r-- | templates/repo/editor/edit.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/issue/comment_tab.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/issue/view_content.tmpl | 6 | ||||
-rw-r--r-- | templates/repo/issue/view_content/comments.tmpl | 92 |
11 files changed, 321 insertions, 18 deletions
diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 84f25f0839..77a0e955e1 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -1,13 +1,16 @@ {{if .DiffNotAvailable}} <h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4> {{else}} - <div class="diff-detail-box diff-box"> + <div class="diff-detail-box diff-box ui sticky"> <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 toggle button" href="?style={{if .IsSplitStyle}}unified{{else}}split{{end}}">{{ if .IsSplitStyle }}{{.i18n.Tr "repo.diff.show_unified_view"}}{{else}}{{.i18n.Tr "repo.diff.show_split_view"}}{{end}}</a> <a class="ui tiny basic toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a> + {{if $.SignedUserID}} + {{template "repo/diff/new_review" .}} + {{end}} </div> </div> <ol class="detail-files hide" id="diff-files"> @@ -100,21 +103,59 @@ <tr class="{{DiffLineTypeToStr .GetType}}-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-code halfwidth"> + <td class="lines-code lines-code-old halfwidth"> + {{if and $.root.SignedUserID $line.CanComment}} + <a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a> + {{end}} <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre> </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 halfwidth"> + + <td class="lines-code lines-code-new halfwidth"> + {{if and $.root.SignedUserID $line.CanComment}} + <a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a> + {{end}} <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre> </td> </tr> + {{if gt (len $line.Comments) 0}} + <tr class="add-code-comment"> + <td class="lines-num"></td> + <td class="add-comment-left"> + {{if eq $line.GetCommentSide "previous"}} + <div class="field comment-code-cloud"> + <div class="comment-list"> + <ui class="ui comments"> + {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} + </ui> + </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}} + </div> + {{end}} + </td> + <td class="lines-num"></td> + <td class="add-comment-right"> + {{if eq $line.GetCommentSide "proposed"}} + <div class="field comment-code-cloud"> + <div class="comment-list"> + <ui class="ui comments"> + {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} + </ui> + </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}} + </div> + {{end}} + </td> + </tr> + {{end}} {{end}} {{end}} {{else}} - {{template "repo/diff/section_unified" .}} + {{template "repo/diff/section_unified" dict "file" . "root" $}} {{end}} </tbody> </table> @@ -135,6 +176,28 @@ </div> {{end}} + <div id="pull_review_add_comment" class="hide"> + {{template "repo/diff/new_comment" dict "root" .}} + </div> + <div class="hide" id="edit-content-form"> + <div class="ui comment form"> + <div class="ui top attached tabular menu"> + <a class="active write item">{{$.i18n.Tr "write"}}</a> + <a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> + </div> + <div class="ui bottom attached active write tab segment"> + <textarea tabindex="1" id="content" name="content"></textarea> + </div> + <div class="ui bottom attached tab preview segment markdown"> + {{$.i18n.Tr "loading"}} + </div> + <div class="text right edit buttons"> + <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div> + <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div> + </div> + </div> + </div> + {{if .IsSplitStyle}} <script> (function() { diff --git a/templates/repo/diff/comment_form.tmpl b/templates/repo/diff/comment_form.tmpl new file mode 100644 index 0000000000..afb30a368f --- /dev/null +++ b/templates/repo/diff/comment_form.tmpl @@ -0,0 +1,45 @@ +{{if $.root.SignedUserID}} + {{if $.hidden}} + <button class="comment-form-reply ui green labeled icon tiny button"><i class="reply icon"></i> {{$.root.i18n.Tr "repo.diff.comment.reply"}}</button> + {{end}} + <form class="ui form {{if $.hidden}}hide comment-form{{end}}" action="{{$.root.Issue.HTMLURL}}/files/reviews/comments" method="post"> + {{$.root.CsrfTokenHtml}} + <input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}"> + <input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}"> + <input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}"> + <input type="hidden" name="diff_start_cid"> + <input type="hidden" name="diff_end_cid"> + <input type="hidden" name="diff_base_cid"> + <div class="ui top attached tabular menu" {{if not $.hidden}}onload="assingMenuAttributes(this)" {{end}}data-write="write" data-preview="preview"> + <a class="active item" data-tab="write">{{$.root.i18n.Tr "write"}}</a> + <a class="item" data-tab="preview" data-url="{{$.root.AppSubUrl}}/api/v1/markdown" data-context="{{$.root.RepoLink}}">{{$.root.i18n.Tr "preview"}}</a> + </div> + <div class="ui bottom attached active tab segment" data-tab="write"> + <div class="field"> + <textarea name="content" placeholder="{{$.root.i18n.Tr "repo.diff.comment.placeholder"}}"></textarea> + </div> + </div> + <div class="ui bottom attached tab segment markdown" data-tab="preview"> + {{.i18n.Tr "loading"}} + </div> + <div class="footer"> + <span class="markdown-info"><i class="octicon octicon-markdown"></i> {{$.root.i18n.Tr "repo.diff.comment.markdown_info"}}</span> + <div class="ui right floated"> + {{if not $.reply}} + {{if $.root.CurrentReview}} + <button name="is_review" value="true" type="submit" + class="ui submit green tiny button btn-add-comment">{{$.root.i18n.Tr "repo.diff.comment.add_review_comment"}}</button> + {{else}} + <button name="is_review" value="true" type="submit" + class="ui submit green tiny button btn-start-review">{{$.root.i18n.Tr "repo.diff.comment.start_review"}}</button> + {{end}} + {{end}} + <button type="submit" + class="ui submit tiny basic button btn-add-single">{{$.root.i18n.Tr "repo.diff.comment.add_single_comment"}}</button> + {{if or (not $.HasComments) $.hidden}} + <button type="button" class="ui submit tiny basic button btn-cancel" onclick="cancelCodeComment(this);">{{$.root.i18n.Tr "cancel"}}</button> + {{end}} + </div> + </div> + </form> +{{end}} diff --git a/templates/repo/diff/comment_form_datahandler.tmpl b/templates/repo/diff/comment_form_datahandler.tmpl new file mode 100644 index 0000000000..9656944719 --- /dev/null +++ b/templates/repo/diff/comment_form_datahandler.tmpl @@ -0,0 +1,7 @@ +{{if $.comment}} + {{ template "repo/diff/comment_form" dict "root" $.root "hidden" $.hidden "reply" $.reply "Line" $.comment.UnsignedLine "File" $.comment.TreePath "Side" $.comment.DiffSide "HasComments" true}} +{{else if $.root}} + {{ template "repo/diff/comment_form" $}} +{{else}} + {{ template "repo/diff/comment_form" dict "root" $}} +{{end}} diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl new file mode 100644 index 0000000000..18221e36ed --- /dev/null +++ b/templates/repo/diff/comments.tmpl @@ -0,0 +1,51 @@ +{{range .comments}} + +{{ $createdStr:= TimeSinceUnix .CreatedUnix $.root.Lang }} +<div class="comment" id="{{.HashTag}}"> + <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> + <img src="{{.Poster.RelAvatarLink}}"> + </a> + <div class="content"> + <div class="ui top attached header"> + <span class="text grey"><a {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a> {{$.root.i18n.Tr "repo.issues.commented_at" .HashTag $createdStr | Safe}}</span> + <div class="ui right actions"> + {{if and .Review}} + {{if eq .Review.Type 0}} + <div class="item tag"> + {{$.root.i18n.Tr "repo.issues.review.pending"}} + </div> + {{else}} + <div class="item tag"> + {{$.root.i18n.Tr "repo.issues.review.review"}} + </div> + {{end}} + {{end}} + {{template "repo/issue/view_content/add_reaction" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) }} + {{if or $.root.IsRepositoryAdmin (eq .Poster.ID $.root.SignedUserID)}} + <div class="item action"> + <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a> + <a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.root.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.root.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a> + </div> + {{end}} + </div> + </div> + <div class="ui attached segment"> + <div class="render-content markdown has-emoji"> + {{if .RenderedContent}} + {{.RenderedContent|Str2html}} + {{else}} + <span class="no-content">{{$.root.i18n.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div class="raw-content hide">{{.Content}}</div> + <div class="edit-content-zone hide" data-write="issuecomment-{{.ID}}-write" data-preview="issuecomment-{{.ID}}-preview" data-update-url="{{$.root.RepoLink}}/comments/{{.ID}}" data-context="{{$.root.RepoLink}}"></div> + </div> + {{$reactions := .Reactions.GroupByType}} + {{if $reactions}} + <div class="ui attached segment reactions"> + {{template "repo/issue/view_content/reactions" Dict "ctx" $ "ActionURL" (Printf "%s/comments/%d/reactions" $.root.RepoLink .ID) "Reactions" $reactions }} + </div> + {{end}} + </div> +</div> +{{end}} diff --git a/templates/repo/diff/new_comment.tmpl b/templates/repo/diff/new_comment.tmpl new file mode 100644 index 0000000000..d8b6ccb9dd --- /dev/null +++ b/templates/repo/diff/new_comment.tmpl @@ -0,0 +1,3 @@ +<div class="field comment-code-cloud"> + {{template "repo/diff/comment_form_datahandler" .}} +</div> diff --git a/templates/repo/diff/new_review.tmpl b/templates/repo/diff/new_review.tmpl new file mode 100644 index 0000000000..2b49ac7296 --- /dev/null +++ b/templates/repo/diff/new_review.tmpl @@ -0,0 +1,28 @@ +<div class="ui top right pointing dropdown custom" id="review-box"> + <div class="ui tiny green button btn-review"> + <span class="text">{{.i18n.Tr "repo.diff.review"}}</span> + <i class="dropdown icon"></i> + </div> + <div class="menu"> + <div class="ui clearing segment"> + <form class="ui form" action="{{.Link}}/reviews/submit" method="post"> + {{.CsrfTokenHtml}} + <i class="ui right floated link icon close"></i> + <div class="header"> + {{$.i18n.Tr "repo.diff.review.header"}} + </div> + <div class="ui field"> + <textarea name="content" tabindex="0" rows="2" + placeholder="{{$.i18n.Tr "repo.diff.review.placeholder"}}"></textarea> + </div> + <div class="ui divider"></div> + <button type="submit" name="type" value="approve" + class="ui submit green tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.approve"}}</button> + <button type="submit" name="type" value="comment" + class="ui submit tiny basic button btn-submit">{{$.i18n.Tr "repo.diff.review.comment"}}</button> + <button type="submit" name="type" value="reject" + class="ui submit red tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.reject"}}</button> + </form> + </div> + </div> +</div> diff --git a/templates/repo/diff/section_unified.tmpl b/templates/repo/diff/section_unified.tmpl index 996c0c0137..491572cded 100644 --- a/templates/repo/diff/section_unified.tmpl +++ b/templates/repo/diff/section_unified.tmpl @@ -1,4 +1,4 @@ -{{$file := .}} +{{$file := .file}} {{$highlightClass := $file.GetHighlightClass}} {{range $j, $section := $file.Sections}} {{range $k, $line := $section.Lines}} @@ -15,9 +15,27 @@ <span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}">{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}</span> </td> {{end}} - <td class="lines-code"> + <td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}"> + {{if and $.root.SignedUserID $line.CanComment}} + <a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-path="{{$file.Name}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">+</a> + {{end}} <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre> </td> </tr> + {{if gt (len $line.Comments) 0}} + <tr> + <td colspan="2" class="lines-num"></td> + <td class="add-comment-left add-comment-right"> + <div class="field comment-code-cloud"> + <div class="comment-list"> + <ui class="ui comments"> + {{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}} + </ui> + </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $.root "comment" (index $line.Comments 0)}} + </div> + </td> + </tr> + {{end}} {{end}} -{{end}}
\ No newline at end of file +{{end}} diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 50d8f6828c..5625ac1000 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -30,7 +30,7 @@ <div class="ui top attached tabular menu" data-write="write" data-preview="preview" data-diff="diff"> <a class="active item" data-tab="write"><i class="octicon octicon-code"></i> {{if .IsNewFile}}{{.i18n.Tr "repo.editor.new_file"}}{{else}}{{.i18n.Tr "repo.editor.edit_file"}}{{end}}</a> {{if not .IsNewFile}} - <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "repo.release.preview"}}</a> + <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}/src/{{.BranchNameSubURL}}" data-preview-file-modes="{{.PreviewableFileModes}}"><i class="octicon octicon-eye"></i> {{.i18n.Tr "preview"}}</a> <a class="item" data-tab="diff" data-url="{{.RepoLink}}/_preview/{{.BranchName}}/{{.TreePath}}" data-context="{{.BranchLink}}"><i class="octicon octicon-diff"></i> {{.i18n.Tr "repo.editor.preview_changes"}}</a> {{end}} </div> @@ -44,10 +44,10 @@ {{.FileContent}}</textarea> </div> <div class="ui bottom attached tab segment markdown" data-tab="preview"> - {{.i18n.Tr "repo.release.loading"}} + {{.i18n.Tr "loading"}} </div> <div class="ui bottom attached tab segment diff" data-tab="diff"> - {{.i18n.Tr "repo.release.loading"}} + {{.i18n.Tr "loading"}} </div> </div> {{template "repo/editor/commit_form" .}} diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl index afdaa44c06..7c64170484 100644 --- a/templates/repo/issue/comment_tab.tmpl +++ b/templates/repo/issue/comment_tab.tmpl @@ -1,14 +1,14 @@ <div class="field"> <div class="ui top attached tabular menu" data-write="write" data-preview="preview"> - <a class="active item" data-tab="write">{{.i18n.Tr "repo.release.write"}}</a> - <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "repo.release.preview"}}</a> + <a class="active item" data-tab="write">{{.i18n.Tr "write"}}</a> + <a class="item" data-tab="preview" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.RepoLink}}">{{.i18n.Tr "preview"}}</a> </div> <div class="ui bottom attached active tab segment" data-tab="write"> <textarea id="content" class="edit_area js-quick-submit" name="content" tabindex="4" data-id="issue-{{.RepoName}}" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{.Repo.RepoLink}}"> {{if .IssueTemplate}}{{.IssueTemplate}}{{else if .PullRequestTemplate}}{{.PullRequestTemplate}}{{else}}{{.content}}{{end}}</textarea> </div> <div class="ui bottom attached tab segment markdown" data-tab="preview"> - {{.i18n.Tr "repo.release.loading"}} + {{.i18n.Tr "loading"}} </div> </div> {{if .IsAttachmentEnabled}} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index fa4b989caa..e133ee9dc3 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -111,14 +111,14 @@ <div class="hide" id="edit-content-form"> <div class="ui comment form"> <div class="ui top attached tabular menu"> - <a class="active write item">{{$.i18n.Tr "repo.release.write"}}</a> - <a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "repo.release.preview"}}</a> + <a class="active write item">{{$.i18n.Tr "write"}}</a> + <a class="preview item" data-url="{{AppSubUrl}}/api/v1/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a> </div> <div class="ui bottom attached active write tab segment"> <textarea tabindex="1" id="content" name="content"></textarea> </div> <div class="ui bottom attached tab preview segment markdown"> - {{$.i18n.Tr "repo.release.loading"}} + {{$.i18n.Tr "loading"}} </div> <div class="text right edit buttons"> <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div> diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 6a8cd1dacb..ee10ff56f0 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -1,7 +1,7 @@ {{range .Issue.Comments}} {{ $createdStr:= TimeSinceUnix .CreatedUnix $.Lang }} - <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY --> + <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 16 = ADDED_DEADLINE, 17 = MODIFIED_DEADLINE, 18 = REMOVED_DEADLINE, 19 = ADD_DEPENDENCY, 20 = REMOVE_DEPENDENCY, 21 = CODE, 22 = REVIEW --> {{if eq .Type 0}} <div class="comment" id="{{.HashTag}}"> <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> @@ -260,5 +260,93 @@ <span class="text grey"><a href="{{$.RepoLink}}/issues/{{.DependentIssue.Index}}">#{{.DependentIssue.Index}} {{.DependentIssue.Title}}</a></span> </div> </div> - {{end}} + {{else if eq .Type 22}} + <div class="event" id="{{.HashTag}}"> + <span class="octicon octicon-{{.Review.Type.Icon}}"></span> + <a class="ui avatar image" href="{{.Poster.HomeLink}}"> + <img src="{{.Poster.RelAvatarLink}}"> + </a> + <span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a> + {{if eq .Review.Type 1}} + {{$.i18n.Tr "repo.issues.review.approve" $createdStr | Safe}} + {{else if eq .Review.Type 2}} + {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} + {{else if eq .Review.Type 3}} + {{$.i18n.Tr "repo.issues.review.reject" $createdStr | Safe}} + {{else}} + {{$.i18n.Tr "repo.issues.review.comment" $createdStr | Safe}} + {{end}} + </span> + {{if .Content}} + <div class="detail"> + <span class="octicon octicon-quote"></span> + <span class="text grey">{{.Content}}</span> + </div> + {{end}} + {{ range $filename, $lines := .Review.CodeComments}} + {{range $line, $comms := $lines}} + <div class="ui segments"> + <div class="ui segment"> + {{$invalid := (index $comms 0).Invalidated}} + {{if $invalid}} + <button id="show-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="ui compact right labeled button show-outdated"> + <i class="octicon octicon-fold"></i> + {{$.i18n.Tr "repo.issues.review.show_outdated"}} + </button> + <button id="hide-outdated-{{(index $comms 0).ID}}" data-comment="{{(index $comms 0).ID}}" class="hide ui compact right labeled button hide-outdated"> + <i class="octicon octicon-fold"></i> + {{$.i18n.Tr "repo.issues.review.hide_outdated"}} + </button> + {{end}} + <a href="{{(index $comms 0).CodeCommentURL}}" class="file-comment">{{$filename}}</a> + </div> + {{$diff := ((index $comms 0).MustAsDiff)}} + {{if $diff}} + {{$file := (index $diff.Files 0)}} + <div id="code-preview-{{(index $comms 0).ID}}" class="ui table segment{{if $invalid}} hide{{end}}"> + <div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}"> + <div class="file-body file-code code-view code-diff code-diff-unified"> + <table> + <tbody> + {{template "repo/diff/section_unified" dict "file" $file "root" $}} + </tbody> + </table> + </div> + </div> + </div> + {{end}} + <div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $invalid}} hide{{end}}"> + <div class="ui comments"> + {{range $comms}} + {{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }} + <div class="comment" id="{{.HashTag}}"> + <a class="avatar"> + <img src="{{.Poster.RelAvatarLink}}"> + </a> + <div class="content"> + <a class="author" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a> + <div class="metadata"> + <span class="date">{{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdSubStr | Safe}}</span> + </div> + <div class="text"> + <div class="render-content markdown has-emoji"> + {{if .RenderedContent}} + {{.RenderedContent|Str2html}} + {{else}} + <span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span> + {{end}} + </div> + <div class="raw-content hide">{{.Content}}</div> + </div> + </div> + </div> + {{end}} + </div> + {{template "repo/diff/comment_form_datahandler" dict "hidden" true "reply" true "root" $ "comment" (index $comms 0)}} + </div> + </div> + {{end}} + {{end}} + </div> + {{end}} {{end}} |