Fix some comment UI rendering bugs
This commit is contained in:
parent
fbaeb02b2d
commit
5dd39d3bca
|
|
@ -67,6 +67,14 @@ func (d *DiffLine) GetType() int {
|
||||||
return int(d.Type)
|
return int(d.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCommentSide returns the comment side of the first comment, if not set returns empty string
|
||||||
|
func (d *DiffLine) GetCommentSide() string {
|
||||||
|
if len(d.Comments) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return d.Comments[0].DiffSide()
|
||||||
|
}
|
||||||
|
|
||||||
// DiffSection represents a section of a DiffFile.
|
// DiffSection represents a section of a DiffFile.
|
||||||
type DiffSection struct {
|
type DiffSection struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
|
||||||
|
|
@ -123,16 +123,32 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{if gt (len $line.Comments) 0}}
|
{{if gt (len $line.Comments) 0}}
|
||||||
<tr>
|
<tr class="add-code-comment">
|
||||||
<td colspan="4" class="add-comment-left add-comment-right">
|
<td class="lines-num"></td>
|
||||||
<div class="field comment-code-cloud">
|
<td class="add-comment-left">
|
||||||
<div class="comment-list">
|
{{if eq $line.GetCommentSide "previous"}}
|
||||||
<ui class="ui comments">
|
<div class="field comment-code-cloud">
|
||||||
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
|
<div class="comment-list">
|
||||||
</ui>
|
<ui class="ui comments">
|
||||||
</div>
|
{{ 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)}}
|
{{template "repo/diff/comment_form_datahandler" dict "hidden" true "root" $ "comment" (index $line.Comments 0)}}
|
||||||
</div>
|
</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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
{{if gt (len $line.Comments) 0}}
|
{{if gt (len $line.Comments) 0}}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4" class="add-comment-left add-comment-right">
|
<td colspan="2" class="lines-num"></td>
|
||||||
|
<td class="add-comment-left add-comment-right">
|
||||||
<div class="field comment-code-cloud">
|
<div class="field comment-code-cloud">
|
||||||
<div class="comment-list">
|
<div class="comment-list">
|
||||||
<ui class="ui comments">
|
<ui class="ui comments">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user