-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Improve diff file headers #36215
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
Improve diff file headers #36215
Changes from 11 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e091430
Improve diff file headers
silverwind c2a4bfc
move diff stat to right
silverwind 4d3fbb4
improve file diff stats rendering
silverwind a3a10fc
fine tune
silverwind 51a0dfe
avoid shrinking copy button, format
silverwind ab3dea7
more enhancements
silverwind f013a64
Merge remote-tracking branch 'origin/main' into diffhead
silverwind 007e07f
fix, lowercase single-word all git.filemode
silverwind b8d4b6f
revert
silverwind 725b957
use template in repo/pulls/tab_menu.tmpl as well
silverwind b7ecd07
remove box-shadow hack
silverwind 05ffc84
Merge branch 'main' into diffhead
wxiaoguang 8b7c6ef
fix various bugs
wxiaoguang 45cb4dc
add color vars to dark theme
wxiaoguang 84d69d2
fix comment
wxiaoguang e888dbd
Merge branch 'main' into diffhead
wxiaoguang 5eca4cc
fix layout
wxiaoguang 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
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
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,5 +1,17 @@ | ||
| {{Eval .file.Addition "+" .file.Deletion}} | ||
| <span class="diff-stats-bar tw-mx-2" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.stats_desc_file" (Eval .file.Addition "+" .file.Deletion) .file.Addition .file.Deletion}}"> | ||
| {{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}} | ||
| <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .file.Addition "/" "(" .file.Addition "+" .file.Deletion "+" 0.0 ")"}}%"></div> | ||
| </span> | ||
| {{/* Template Attributes: | ||
| * Addition: Number of additions | ||
| * Deletion: Number of deletions | ||
| * Classes: Additional classes for the root element | ||
| */}} | ||
| {{if or .Addition .Deletion}} | ||
| <div class="tw-flex tw-items-center tw-gap-2 tw-text-[13px] tw-font-sans{{if .Classes}} {{.Classes}}{{end}}"> | ||
| <span> | ||
| {{if .Addition}}<span class="tw-text-green">+{{.Addition}}</span>{{end}} | ||
| {{if .Deletion}}<span class="tw-text-red">-{{.Deletion}}</span>{{end}} | ||
wxiaoguang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </span> | ||
| <span class="diff-stats-bar" data-tooltip-content="{{ctx.Locale.Tr "repo.diff.stats_desc_file" (Eval .Addition "+" .Deletion) .Addition .Deletion}}"> | ||
| {{/* if the denominator is zero, then the float result is "width: NaNpx", as before, it just works */}} | ||
| <div class="diff-stats-add-bar" style="width: {{Eval 100 "*" .Addition "/" "(" .Addition "+" .Deletion "+" 0.0 ")"}}%"></div> | ||
| </span> | ||
| </div> | ||
| {{end}} | ||
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
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
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.