Show forms only to users who are logged in

Signed-off-by: Jonas Franz <info@jonasfranz.software>
This commit is contained in:
Jonas Franz 2018-05-25 21:21:47 +02:00 committed by Jonas Franz
parent 229129db33
commit c083682dd8
No known key found for this signature in database
GPG key ID: 506AEEBE80BEDECD
2 changed files with 15 additions and 6 deletions

View file

@ -8,7 +8,9 @@
<div class="ui right"> <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" 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> <a class="ui tiny basic toggle button" data-target="#diff-files">{{.i18n.Tr "repo.diff.show_diff_stats"}}</a>
{{if .IsSigned}}
{{template "repo/diff/new_review" .}} {{template "repo/diff/new_review" .}}
{{end}}
</div> </div>
</div> </div>
<ol class="detail-files hide" id="diff-files"> <ol class="detail-files hide" id="diff-files">
@ -104,7 +106,7 @@
</td> </td>
<td class="lines-code lines-code-old halfwidth"> <td class="lines-code lines-code-old halfwidth">
{{if not (len $line.Comments)}} {{if and $.IsSigned (not (len $line.Comments))}}
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a> <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}} {{end}}
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre> <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
@ -114,7 +116,7 @@
</td> </td>
<td class="lines-code lines-code-new halfwidth"> <td class="lines-code lines-code-new halfwidth">
{{if not (len $line.Comments)}} {{if and $.IsSigned (not (len $line.Comments))}}
<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a> <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}} {{end}}
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre> <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</code></pre>
@ -129,7 +131,12 @@
{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
</ui> </ui>
</div> </div>
{{if $.IsSigned}}
{{template "repo/diff/comment_form_datahandler" dict "root" $ "comment" (index $line.Comments 0)}} {{template "repo/diff/comment_form_datahandler" dict "root" $ "comment" (index $line.Comments 0)}}
{{end}}
{{printf "%v" $}}
<hr>
{{printf "%v" $.IsSigned}}
</div> </div>
</td> </td>
</tr> </tr>

View file

@ -16,7 +16,7 @@
</td> </td>
{{end}} {{end}}
<td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}"> <td class="lines-code {{if (not $line.RightIdx)}}lines-code-old{{end}}">
{{if not (len $line.Comments)}} {{if and $.IsSigned (not (len $line.Comments))}}
<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> <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}} {{end}}
<pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre> <pre><code class="wrap {{if $highlightClass}}language-{{$highlightClass}}{{else}}nohighlight{{end}}">{{$section.GetComputedInlineDiffFor $line}}</code></pre>
@ -31,7 +31,9 @@
{{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}} {{ template "repo/diff/comments" dict "root" $.root "comments" $line.Comments}}
</ui> </ui>
</div> </div>
{{if $.IsSigned}}
{{template "repo/diff/comment_form_datahandler" dict "root" $.root "comment" (index $line.Comments 0)}} {{template "repo/diff/comment_form_datahandler" dict "root" $.root "comment" (index $line.Comments 0)}}
{{end}}
</div> </div>
</td> </td>
</tr> </tr>