mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-22 22:48:12 +08:00
f92a0b68fe
* Resolve error when comparing images Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Check blob existence instead of git-ls when checking if file exists Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Show file metadata also when a file was newly added Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Fixes error in commit view Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Excludes assigning path and image infos for compare routers to service package Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Removes nil default and fixes import order Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Adds missing comments Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Moves methods for assigning compare data to context into repo router package Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com> * Show image compare for deleted images as well. Simplify check if image should be displayed Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>
80 lines
2.8 KiB
Handlebars
80 lines
2.8 KiB
Handlebars
{{ $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">
|
|
{{if or .file.IsDeleted (not .file.IsCreated)}}
|
|
<a href="{{$imagePathOld}}" target="_blank">
|
|
<img src="{{$imagePathOld}}" class="border red" />
|
|
</a>
|
|
{{end}}
|
|
</td>
|
|
<td class="halfwidth center">
|
|
{{if or .file.IsCreated (not .file.IsDeleted)}}
|
|
<a href="{{$imagePathNew}}" target="_blank">
|
|
<img src="{{$imagePathNew}}" class="border green" />
|
|
</a>
|
|
{{end}}
|
|
</td>
|
|
</tr>
|
|
{{ $imageInfoBase := (call .root.ImageInfoBase .file.OldName) }}
|
|
{{ $imageInfoHead := (call .root.ImageInfo .file.Name) }}
|
|
{{if or $imageInfoBase $imageInfoHead }}
|
|
<tr>
|
|
<td class="halfwidth center">
|
|
{{if $imageInfoBase }}
|
|
{{ $classWidth := "" }}
|
|
{{ $classHeight := "" }}
|
|
{{ $classByteSize := "" }}
|
|
{{if $imageInfoHead}}
|
|
{{if not (eq $imageInfoBase.Width $imageInfoHead.Width)}}
|
|
{{ $classWidth = "red" }}
|
|
{{end}}
|
|
{{if not (eq $imageInfoBase.Height $imageInfoHead.Height)}}
|
|
{{ $classHeight = "red" }}
|
|
{{end}}
|
|
{{if not (eq $imageInfoBase.ByteSize $imageInfoHead.ByteSize)}}
|
|
{{ $classByteSize = "red" }}
|
|
{{end}}
|
|
{{end}}
|
|
{{.root.i18n.Tr "repo.diff.file_image_width"}}: <span class="text {{$classWidth}}">{{$imageInfoBase.Width}}</span>
|
|
|
|
|
{{.root.i18n.Tr "repo.diff.file_image_height"}}: <span class="text {{$classHeight}}">{{$imageInfoBase.Height}}</span>
|
|
|
|
|
{{.root.i18n.Tr "repo.diff.file_byte_size"}}: <span class="text {{$classByteSize}}">{{FileSize $imageInfoBase.ByteSize}}</span>
|
|
{{end}}
|
|
</td>
|
|
<td class="halfwidth center">
|
|
{{if $imageInfoHead }}
|
|
{{ $classWidth := "" }}
|
|
{{ $classHeight := "" }}
|
|
{{ $classByteSize := "" }}
|
|
{{if $imageInfoBase}}
|
|
{{if not (eq $imageInfoBase.Width $imageInfoHead.Width)}}
|
|
{{ $classWidth = "green" }}
|
|
{{end}}
|
|
{{if not (eq $imageInfoBase.Height $imageInfoHead.Height)}}
|
|
{{ $classHeight = "green" }}
|
|
{{end}}
|
|
{{if not (eq $imageInfoBase.ByteSize $imageInfoHead.ByteSize)}}
|
|
{{ $classByteSize = "green" }}
|
|
{{end}}
|
|
{{end}}
|
|
{{.root.i18n.Tr "repo.diff.file_image_width"}}: <span class="text {{$classWidth}}">{{$imageInfoHead.Width}}</span>
|
|
|
|
|
{{.root.i18n.Tr "repo.diff.file_image_height"}}: <span class="text {{$classHeight}}">{{$imageInfoHead.Height}}</span>
|
|
|
|
|
{{.root.i18n.Tr "repo.diff.file_byte_size"}}: <span class="text {{$classByteSize}}">{{FileSize $imageInfoHead.ByteSize}}</span>
|
|
{{end}}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|