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)
|
||||
}
|
||||
|
||||
// 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.
|
||||
type DiffSection struct {
|
||||
Name string
|
||||
|
|
|
@ -123,16 +123,32 @@
|
|||
</td>
|
||||
</tr>
|
||||
{{if gt (len $line.Comments) 0}}
|
||||
<tr>
|
||||
<td colspan="4" 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" $ "comments" $line.Comments}}
|
||||
</ui>
|
||||
</div>
|
||||
<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>
|
||||
</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}}
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
</tr>
|
||||
{{if gt (len $line.Comments) 0}}
|
||||
<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="comment-list">
|
||||
<ui class="ui comments">
|
||||
|
|
Loading…
Reference in New Issue
Block a user