You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
gitea/templates/repo/diff/image_diff.tmpl

46 lines
2.2 KiB

{{ $imagePathOld := printf "%s/%s" .root.BeforeRawPath (EscapePound .file.OldName) }}
{{ $imagePathNew := printf "%s/%s" .root.RawPath (EscapePound .file.Name) }}
<tr>
<th class="halfwidth center">
{{.root.i18n.Tr "repo.diff.file_before"}}
</th>
<th class="halfwidth center">
{{.root.i18n.Tr "repo.diff.file_after"}}
</th>
</tr>
<tr>
<td class="halfwidth center">
{{ $oldImageExists := (call .root.FileExistsInBaseCommit .file.OldName) }}
{{if $oldImageExists}}
<a href="{{$imagePathOld}}" target="_blank">
<img src="{{$imagePathOld}}" class="border red" />
</a>
{{end}}
</td>
<td class="halfwidth center">
<a href="{{$imagePathNew}}" target="_blank">
<img src="{{$imagePathNew}}" class="border green" />
</a>
</td>
</tr>
{{ $imageInfoBase := (call .root.ImageInfoBase .file.OldName) }}
{{ $imageInfoHead := (call .root.ImageInfo .file.Name) }}
{{if and $imageInfoBase $imageInfoHead }}
<tr>
<td class="halfwidth center">
{{.root.i18n.Tr "repo.diff.file_image_width"}}: <span class="text {{if not (eq $imageInfoBase.Width $imageInfoHead.Width)}}red{{end}}">{{$imageInfoBase.Width}}</span>
&nbsp;|&nbsp;
{{.root.i18n.Tr "repo.diff.file_image_height"}}: <span class="text {{if not (eq $imageInfoBase.Height $imageInfoHead.Height)}}red{{end}}">{{$imageInfoBase.Height}}</span>
&nbsp;|&nbsp;
{{.root.i18n.Tr "repo.diff.file_byte_size"}}: <span class="text {{if not (eq $imageInfoBase.ByteSize $imageInfoHead.ByteSize)}}red{{end}}">{{FileSize $imageInfoBase.ByteSize}}</span>
</td>
<td class="halfwidth center">
{{.root.i18n.Tr "repo.diff.file_image_width"}}: <span class="text {{if not (eq $imageInfoBase.Width $imageInfoHead.Width)}}green{{end}}">{{$imageInfoHead.Width}}</span>
&nbsp;|&nbsp;
{{.root.i18n.Tr "repo.diff.file_image_height"}}: <span class="text {{if not (eq $imageInfoBase.Height $imageInfoHead.Height)}}green{{end}}">{{$imageInfoHead.Height}}</span>
&nbsp;|&nbsp;
{{.root.i18n.Tr "repo.diff.file_byte_size"}}: <span class="text {{if not (eq $imageInfoBase.ByteSize $imageInfoHead.ByteSize)}}green{{end}}">{{FileSize $imageInfoHead.ByteSize}}</span>
</td>
</tr>
{{end}}