mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 02:38:35 +00:00
Initial ui components for pull request review
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
{{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>
|
||||
{{template "repo/diff/new_review" .}}
|
||||
</div>
|
||||
</div>
|
||||
<ol class="detail-files hide" id="diff-files">
|
||||
@@ -100,14 +101,20 @@
|
||||
<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>
|
||||
{{if $line.LeftIdx}}
|
||||
<a class="ui green button add-code-comment add-code-comment-left" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="lines-code halfwidth">
|
||||
<td class="lines-code lines-code-old halfwidth">
|
||||
<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>
|
||||
{{if $line.RightIdx}}
|
||||
<a class="ui green button add-code-comment add-code-comment-right" data-side="right" data-idx="{{$line.RightIdx}}">+</a>
|
||||
{{end}}
|
||||
</td>
|
||||
<td class="lines-code halfwidth">
|
||||
<td class="lines-code lines-code-new halfwidth">
|
||||
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -135,6 +142,10 @@
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div id="pull_review_add_comment" class="hide">
|
||||
{{template "repo/diff/new_comment" .}}
|
||||
</div>
|
||||
|
||||
{{if .IsSplitStyle}}
|
||||
<script>
|
||||
(function() {
|
||||
|
33
templates/repo/diff/new_comment.tmpl
Normal file
33
templates/repo/diff/new_comment.tmpl
Normal file
@@ -0,0 +1,33 @@
|
||||
<div class="field comment-code-cloud">
|
||||
<form class="ui form" action="{{.Link}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<input type="hidden" name="side">
|
||||
<input type="hidden" name="line">
|
||||
<input type="hidden" name="path">
|
||||
<input type="hidden" name="commit_id">
|
||||
<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" data-write="write" data-preview="preview">
|
||||
<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">
|
||||
<div class="field">
|
||||
<textarea name="content" placeholder="{{$.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> {{$.i18n.Tr "repo.diff.comment.markdown_info"}}</span>
|
||||
<div class="ui right floated">
|
||||
<div class="ui submit tiny basic button btn-cancel">{{$.i18n.Tr "cancel"}}</div>
|
||||
<div class="ui submit tiny basic button btn-add-single">{{$.i18n.Tr "repo.diff.comment.add_single_comment"}}</div>
|
||||
<div class="ui submit green tiny button btn-add-comment">{{$.i18n.Tr "repo.diff.comment.add_review_comment"}}</div>
|
||||
<div class="ui submit green tiny button btn-start-review">{{$.i18n.Tr "repo.diff.comment.start_review"}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
26
templates/repo/diff/new_review.tmpl
Normal file
26
templates/repo/diff/new_review.tmpl
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="ui top right pointing dropdown custom">
|
||||
<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}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="ui right floated">
|
||||
<a href="#" class="close"><i class="icon close"></i></a>
|
||||
</div>
|
||||
<div class="header">
|
||||
{{$.i18n.Tr "repo.diff.review.header"}}
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<textarea name="comment" tabindex="0" rows="2" placeholder="{{$.i18n.Tr "repo.diff.review.placeholder"}}"></textarea>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
<div class="ui submit green tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.approve"}}</div>
|
||||
<div class="ui submit tiny basic button btn-submit">{{$.i18n.Tr "repo.diff.review.comment"}}</div>
|
||||
<div class="ui submit red tiny button btn-submit">{{$.i18n.Tr "repo.diff.review.reject"}}</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -13,11 +13,12 @@
|
||||
</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>
|
||||
<a class="ui green button add-code-comment add-code-comment-{{if $line.RightIdx}}right{{else}}left{{end}}" data-side="{{if $line.RightIdx}}right{{else}}left{{end}}" data-idx="{{if $line.RightIdx}}{{$line.RightIdx}}{{else}}{{$line.LeftIdx}}{{end}}">+</a>
|
||||
</td>
|
||||
{{end}}
|
||||
<td class="lines-code">
|
||||
<td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}">
|
||||
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
Reference in New Issue
Block a user