summaryrefslogtreecommitdiffstats
path: root/templates/repo/diff/image_diff.tmpl
blob: 6afb985e9a98b734ca6fd7fcb985c5feebf5be76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{{ $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>
 		&nbsp;|&nbsp;
 	    {{.root.i18n.Tr "repo.diff.file_image_height"}}: <span class="text {{$classHeight}}">{{$imageInfoBase.Height}}</span>
 		&nbsp;|&nbsp;
 	    {{.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>
 		&nbsp;|&nbsp;
 	    {{.root.i18n.Tr "repo.diff.file_image_height"}}: <span class="text {{$classHeight}}">{{$imageInfoHead.Height}}</span>
 		&nbsp;|&nbsp;
 	    {{.root.i18n.Tr "repo.diff.file_byte_size"}}: <span class="text {{$classByteSize}}">{{FileSize $imageInfoHead.ByteSize}}</span>
 	{{end}}
 	</td>
 </tr>
{{end}}