-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Add Image Diff options in Diff view #14450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
caf3f10
Added image diff variations.
KN4CK3R 1a6fe56
Reenabled view for single files.
KN4CK3R e00b38f
Moved range input to top.
KN4CK3R 07b80aa
Show spinner while loading.
KN4CK3R 3d1e299
Added translation.
KN4CK3R 8e5b67d
Merge branch 'master' into feature-image-diff
6543 6acaace
Moved code to own file.
KN4CK3R aefc3d8
Moved style to own file.
KN4CK3R e3a48e1
Merge branch 'master' into feature-image-diff
6543 2a79916
fix lint
6543 b55f30a
Merge branch 'master' into feature-image-diff
6543 b3a95be
Merge branch 'master' into feature-image-diff
zeripath 95f80a4
Merge branch 'master' into feature-image-diff
6543 6572f6f
Merge branch 'master' into feature-image-diff
6543 07f03f4
Merge branch 'master' into feature-image-diff
6543 7135633
Force active class.
KN4CK3R 37789d2
Merge branch 'master' into feature-image-diff
6543 48c8d52
Merge branch 'master' into feature-image-diff
6543 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,79 +1,107 @@ | ||
| {{ $imagePathOld := printf "%s/%s" .root.BeforeRawPath (EscapePound .file.OldName) }} | ||
| {{ $imagePathNew := printf "%s/%s" .root.RawPath (EscapePound .file.Name) }} | ||
|
|
||
| <tr> | ||
| <th class="halfwidth center pl-3 pr-2"> | ||
| {{.root.i18n.Tr "repo.diff.file_before"}} | ||
| </th> | ||
| <th class="halfwidth center pl-2 pr-3"> | ||
| {{.root.i18n.Tr "repo.diff.file_after"}} | ||
| </th> | ||
| </tr> | ||
| <tr> | ||
| <td class="halfwidth center pl-3 pr-2"> | ||
| {{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 pl-2 pr-3"> | ||
| {{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 }} | ||
| {{if or $imageInfoBase $imageInfoHead}} | ||
| <tr> | ||
| <td class="halfwidth center pl-3 pr-2"> | ||
| {{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" }} | ||
| <td colspan="2"> | ||
| <div class="image-diff" data-path-before="{{$imagePathOld}}" data-path-after="{{$imagePathNew}}"> | ||
| <div class="ui secondary pointing tabular top attached borderless menu stackable new-menu"> | ||
| <div class="new-menu-inner"> | ||
| <a class="item active" data-tab="diff-side-by-side">Side by Side</a> | ||
| {{if and $imageInfoBase $imageInfoHead}} | ||
| <a class="item" data-tab="diff-swipe">Swipe</a> | ||
| <a class="item" data-tab="diff-overlay">Overlay</a> | ||
| {{end}} | ||
| </div> | ||
| </div> | ||
| <div class="ui bottom attached tab image-diff-container" data-tab="diff-side-by-side"> | ||
| <div class="diff-side-by-side hide"> | ||
| {{if $imageInfoBase }} | ||
| <span class="side"> | ||
| <p class="side-header">{{.root.i18n.Tr "repo.diff.file_before"}}</p> | ||
| <span class="before-container"><img class="image-before" /></span> | ||
| <p> | ||
| {{ $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> | ||
| </p> | ||
| </span> | ||
| {{end}} | ||
| {{if $imageInfoHead }} | ||
| <span class="side"> | ||
| <p class="side-header">{{.root.i18n.Tr "repo.diff.file_after"}}</p> | ||
| <span class="after-container"><img class="image-after" /></span> | ||
| <p> | ||
| {{ $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> | ||
| </p> | ||
| </span> | ||
| {{end}} | ||
| </div> | ||
| </div> | ||
| {{if and $imageInfoBase $imageInfoHead}} | ||
| <div class="ui bottom attached tab image-diff-container hide" data-tab="diff-swipe"> | ||
| <div class="diff-swipe hide"> | ||
| <div class="swipe-frame"> | ||
| <span class="before-container"><img class="image-before" /></span> | ||
| <span class="swipe-container"> | ||
| <span class="after-container"><img class="image-after" /></span> | ||
| </span> | ||
| <span class="swipe-bar"> | ||
| <span class="handle top-handle"></span> | ||
| <span class="handle bottom-handle"></span> | ||
| </span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="ui bottom attached tab image-diff-container hide" data-tab="diff-overlay"> | ||
| <div class="diff-overlay hide"> | ||
| <div class="overlay-frame"> | ||
| <div class="ui centered"> | ||
| <input type="range" min="0" max="100" value="50" /> | ||
| </div> | ||
| <span class="before-container"><img class="image-before"/></span> | ||
| <span class="after-container"><img class="image-after" /></span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| {{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 pl-2 pr-3"> | ||
| {{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}} | ||
| <div class="ui active centered inline loader"></div> | ||
| </div> | ||
| </td> | ||
| </tr> | ||
| {{end}} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.