liuyuchao-patch-2 #4
81
mergo.go
Normal file
81
mergo.go
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
{{if or .blobBase .blobHead}}
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="image-diff" data-path-before="{{.root.BeforeRawPath}}/{{PathEscapeSegments .file.OldName}}" data-path-after="{{.root.RawPath}}/{{PathEscapeSegments .file.Name}}">
|
||||||
|
<div class="ui secondary pointing tabular top attached borderless menu new-menu">
|
||||||
|
<div class="new-menu-inner">
|
||||||
|
<a class="item active" data-tab="diff-side-by-side-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.side_by_side"}}</a>
|
||||||
|
{{if and .blobBase .blobHead}}
|
||||||
|
<a class="item" data-tab="diff-swipe-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.swipe"}}</a>
|
||||||
|
<a class="item" data-tab="diff-overlay-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.overlay"}}</a>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="gt-hidden">
|
||||||
|
<div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}">
|
||||||
|
<div class="diff-side-by-side">
|
||||||
|
{{if .blobBase}}
|
||||||
|
<span class="side">
|
||||||
|
<p class="side-header">{{.root.locale.Tr "repo.diff.file_before"}}</p>
|
||||||
|
<span class="before-container"><img class="image-before"></span>
|
||||||
|
<p>
|
||||||
|
<span class="bounds-info-before">
|
||||||
|
{{.root.locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span>
|
||||||
|
|
|
||||||
|
{{.root.locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
|
||||||
|
|
|
||||||
|
</span>
|
||||||
|
{{.root.locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .blobBase.Size}}</span>
|
||||||
|
</p>
|
||||||
|
</span>
|
||||||
|
{{end}}
|
||||||
|
{{if .blobHead}}
|
||||||
|
<span class="side">
|
||||||
|
<p class="side-header">{{.root.locale.Tr "repo.diff.file_after"}}</p>
|
||||||
|
<span class="after-container"><img class="image-after"></span>
|
||||||
|
<p>
|
||||||
|
<span class="bounds-info-after">
|
||||||
|
{{.root.locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span>
|
||||||
|
|
|
||||||
|
{{.root.locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
|
||||||
|
|
|
||||||
|
</span>
|
||||||
|
{{.root.locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .blobHead.Size}}</span>
|
||||||
|
</p>
|
||||||
|
</span>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{if and .blobBase .blobHead}}
|
||||||
|
<div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.Index}}">
|
||||||
|
<div class="diff-swipe">
|
||||||
|
<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" data-tab="diff-overlay-{{.file.Index}}">
|
||||||
|
<div class="diff-overlay">
|
||||||
|
<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}}
|
||||||
|
</div>
|
||||||
|
<div class="ui active centered inline loader gt-mb-4"></div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
57
test3
57
test3
@ -15,18 +15,51 @@ fds
|
|||||||
af
|
af
|
||||||
asdfasdf
|
asdfasdf
|
||||||
asdfasdf
|
asdfasdf
|
||||||
asd
|
a{{if and $.root.SignedUserID (not $.Repository.IsArchived)}}
|
||||||
fas
|
<form class="ui form {{if $.hidden}}gt-hidden comment-form{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post">
|
||||||
df
|
{{$.root.CsrfTokenHtml}}
|
||||||
asdf
|
<input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
|
||||||
asd
|
<input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}">
|
||||||
f
|
<input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}">
|
||||||
asdf
|
<input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}">
|
||||||
asd
|
<input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}">
|
||||||
f
|
<input type="hidden" name="diff_start_cid">
|
||||||
asdf
|
<input type="hidden" name="diff_end_cid">
|
||||||
asd
|
<input type="hidden" name="diff_base_cid">
|
||||||
fas
|
|
||||||
|
{{template "shared/combomarkdowneditor" (dict
|
||||||
|
"locale" $.root.locale
|
||||||
|
"MarkdownPreviewUrl" (print $.root.Repository.Link "/markup")
|
||||||
|
"MarkdownPreviewContext" $.root.RepoLink
|
||||||
|
"TextareaName" "content"
|
||||||
|
"TextareaPlaceholder" ($.locale.Tr "repo.diff.comment.placeholder")
|
||||||
|
"DropzoneParentContainer" "form"
|
||||||
|
"DisableAutosize" "true"
|
||||||
|
)}}
|
||||||
|
|
||||||
|
<div class="field footer gt-mx-3">
|
||||||
|
<span class="markup-info">{{svg "octicon-markup"}} {{$.root.locale.Tr "repo.diff.comment.markdown_info"}}</span>
|
||||||
|
<div class="ui right">
|
||||||
|
{{if $.reply}}
|
||||||
|
<button class="ui submit green tiny button btn-reply" type="submit">{{$.root.locale.Tr "repo.diff.comment.reply"}}</button>
|
||||||
|
<input type="hidden" name="reply" value="{{$.reply}}">
|
||||||
|
<input type="hidden" name="single_review" value="true">
|
||||||
|
{{else}}
|
||||||
|
{{if $.root.CurrentReview}}
|
||||||
|
<button name="pending_review" type="submit" class="ui submit green tiny button btn-add-comment">{{$.root.locale.Tr "repo.diff.comment.add_review_comment"}}</button>
|
||||||
|
{{else}}
|
||||||
|
<button name="pending_review" type="submit" class="ui submit green tiny button btn-start-review">{{$.root.locale.Tr "repo.diff.comment.start_review"}}</button>
|
||||||
|
<button name="single_review" value="true" type="submit" class="ui submit tiny basic button btn-add-single">{{$.root.locale.Tr "repo.diff.comment.add_single_comment"}}</button>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if or (not $.HasComments) $.hidden}}
|
||||||
|
<button type="button" class="ui submit tiny basic button btn-cancel cancel-code-comment">{{$.root.locale.Tr "cancel"}}</button>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
df
|
df
|
||||||
asd
|
asd
|
||||||
fa
|
fa
|
||||||
|
58
test4
58
test4
@ -1 +1,59 @@
|
|||||||
test
|
test
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{$result := call .root.CreateCsvDiff .file .blobBase .blobHead}}
|
||||||
|
{{if $result.Error}}
|
||||||
|
<div class="ui center">{{$result.Error}}</div>
|
||||||
|
{{else if $result.Sections}}
|
||||||
|
<table class="data-table">
|
||||||
|
{{range $i, $section := $result.Sections}}
|
||||||
|
<tbody {{if gt $i 0}}class="section"{{end}}>
|
||||||
|
{{range $j, $row := $section.Rows}}
|
||||||
|
<tr>
|
||||||
|
{{if and (eq $i 0) (eq $j 0)}}
|
||||||
|
<th class="line-num">{{.RowIdx}}</th>
|
||||||
|
{{range $j, $cell := $row.Cells}}
|
||||||
|
{{if not $cell}}
|
||||||
|
<th></th>
|
||||||
|
{{else if eq $cell.Type 2}}
|
||||||
|
<th class="modified"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></th>
|
||||||
|
{{else if eq $cell.Type 3}}
|
||||||
|
<th class="added"><span class="added-code">{{.RightCell}}</span></th>
|
||||||
|
{{else if eq $cell.Type 4}}
|
||||||
|
<th class="removed"><span class="removed-code">{{.LeftCell}}</span></th>
|
||||||
|
{{else if eq $cell.Type 5}}
|
||||||
|
<th class="moved">{{.RightCell}}</th>
|
||||||
|
{{else if eq $cell.Type 6}}
|
||||||
|
<th class="moved"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></th>
|
||||||
|
{{else}}
|
||||||
|
<th>{{.RightCell}}</th>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
<td class="line-num">{{if .RowIdx}}{{.RowIdx}}{{end}}</td>
|
||||||
|
{{range $j, $cell := $row.Cells}}
|
||||||
|
{{if not $cell}}
|
||||||
|
<td></td>
|
||||||
|
{{else if eq $cell.Type 2}}
|
||||||
|
<td class="modified"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></td>
|
||||||
|
{{else if eq $cell.Type 3}}
|
||||||
|
<td class="added"><span class="added-code">{{.RightCell}}</span></td>
|
||||||
|
{{else if eq $cell.Type 4}}
|
||||||
|
<td class="removed"><span class="removed-code">{{.LeftCell}}</span></td>
|
||||||
|
{{else if eq $cell.Type 5}}
|
||||||
|
<td class="moved">{{.RightCell}}</td>
|
||||||
|
{{else if eq $cell.Type 6}}
|
||||||
|
<td class="moved"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></td>
|
||||||
|
{{else}}
|
||||||
|
<td>{{.RightCell}}</td>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
|
</tbody>
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
{{end}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
224
tmp/merge/tewtgogo.go
Normal file
224
tmp/merge/tewtgogo.go
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
<div>
|
||||||
|
<div class="diff-detail-box diff-box sticky gt-df gt-sb gt-ac gt-fw">
|
||||||
|
<div class="gt-df gt-ac gt-fw">
|
||||||
|
{{if not .DiffNotAvailable}}
|
||||||
|
<button class="diff-toggle-file-tree-button gt-df gt-ac not-mobile" data-show-text="{{.locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{.locale.Tr "repo.diff.hide_file_tree"}}">
|
||||||
|
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
|
||||||
|
{{svg "octicon-sidebar-collapse" 20 "icon gt-hidden"}}
|
||||||
|
{{svg "octicon-sidebar-expand" 20 "icon gt-hidden"}}
|
||||||
|
</button>
|
||||||
|
<script>
|
||||||
|
// Default to true if unset
|
||||||
|
const diffTreeVisible = localStorage?.getItem('diff_file_tree_visible') !== 'false';
|
||||||
|
const diffTreeBtn = document.querySelector('.diff-toggle-file-tree-button');
|
||||||
|
const diffTreeIcon = `.octicon-sidebar-${diffTreeVisible ? 'expand' : 'collapse'}`;
|
||||||
|
diffTreeBtn.querySelector(diffTreeIcon).classList.remove('gt-hidden');
|
||||||
|
diffTreeBtn.setAttribute('data-tooltip-content', diffTreeBtn.getAttribute(diffTreeVisible ? 'data-hide-text' : 'data-show-text'));
|
||||||
|
</script>
|
||||||
|
<div class="diff-detail-stats gt-df gt-ac gt-fw">
|
||||||
|
{{svg "octicon-diff" 16 "gt-mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<div class="diff-detail-actions gt-df gt-ac gt-gap-2 gt-fw">
|
||||||
|
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}}
|
||||||
|
<div class="gt-df gt-ac gt-fc gt-whitespace-nowrap gt-mr-2">
|
||||||
|
<label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}">
|
||||||
|
{{.locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}}
|
||||||
|
</label>
|
||||||
|
<progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{template "repo/diff/whitespace_dropdown" .}}
|
||||||
|
{{template "repo/diff/options_dropdown" .}}
|
||||||
|
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}}
|
||||||
|
{{template "repo/diff/new_review" .}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{if not .DiffNotAvailable}}
|
||||||
|
<script id="diff-data-script" type="module">
|
||||||
|
const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}}},{{end}}];
|
||||||
|
const diffData = {
|
||||||
|
isIncomplete: {{.Diff.IsIncomplete}},
|
||||||
|
tooManyFilesMessage: "{{$.locale.Tr "repo.diff.too_many_files"}}",
|
||||||
|
binaryFileMessage: "{{$.locale.Tr "repo.diff.bin"}}",
|
||||||
|
showMoreMessage: "{{.locale.Tr "repo.diff.show_more"}}",
|
||||||
|
statisticsMessage: "{{.locale.Tr "repo.diff.stats_desc_file"}}",
|
||||||
|
linkLoadMore: "{{$.Link}}?skip-to={{.Diff.End}}&file-only=true",
|
||||||
|
};
|
||||||
|
|
||||||
|
// for first time loading, the diffFileInfo is a plain object
|
||||||
|
// after the Vue component is mounted, the diffFileInfo is a reactive object
|
||||||
|
// keep in mind that this script block would be executed many times when loading more files, by "loadMoreFiles"
|
||||||
|
let diffFileInfo = window.config.pageData.diffFileInfo || {
|
||||||
|
files:[],
|
||||||
|
fileTreeIsVisible: false,
|
||||||
|
fileListIsVisible: false,
|
||||||
|
isLoadingNewData: false,
|
||||||
|
selectedItem: '',
|
||||||
|
};
|
||||||
|
diffFileInfo = Object.assign(diffFileInfo, diffData);
|
||||||
|
diffFileInfo.files.push(...diffDataFiles);
|
||||||
|
window.config.pageData.diffFileInfo = diffFileInfo;
|
||||||
|
</script>
|
||||||
|
<div id="diff-file-list"></div>
|
||||||
|
{{end}}
|
||||||
|
<div id="diff-container">
|
||||||
|
{{if .DiffNotAvailable}}
|
||||||
|
<h4>{{.locale.Tr "repo.diff.data_not_available"}}</h4>
|
||||||
|
{{else}}
|
||||||
|
<div id="diff-file-tree" class="gt-hidden"></div>
|
||||||
|
<script>
|
||||||
|
if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('gt-hidden');
|
||||||
|
</script>
|
||||||
|
<div id="diff-file-boxes" class="sixteen wide column">
|
||||||
|
{{range $i, $file := .Diff.Files}}
|
||||||
|
{{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}}
|
||||||
|
{{$blobBase := call $.GetBlobByPathForCommit $.BeforeCommit $file.OldName}}
|
||||||
|
{{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}}
|
||||||
|
{{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}}
|
||||||
|
{{$isCsv := (call $.IsCsvFile $file)}}
|
||||||
|
{{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}}
|
||||||
|
{{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
|
||||||
|
{{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.IsArchived)}}
|
||||||
|
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} gt-mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}>
|
||||||
|
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header gt-df gt-ac gt-sb gt-fw">
|
||||||
|
<div class="diff-file-name gt-df gt-ac gt-gap-2 gt-fw">
|
||||||
|
<button class="fold-file btn interact-bg gt-p-2{{if not $isExpandable}} gt-invisible{{end}}">
|
||||||
|
{{if $file.ShouldBeHidden}}
|
||||||
|
{{svg "octicon-chevron-right" 18}}
|
||||||
|
{{else}}
|
||||||
|
{{svg "octicon-chevron-down" 18}}
|
||||||
|
{{end}}
|
||||||
|
</button>
|
||||||
|
<div class="gt-font-semibold gt-df gt-ac gt-mono">
|
||||||
|
{{if $file.IsBin}}
|
||||||
|
<span class="gt-ml-1 gt-mr-3">
|
||||||
|
{{$.locale.Tr "repo.diff.bin"}}
|
||||||
|
</span>
|
||||||
|
{{else}}
|
||||||
|
{{template "repo/diff/stats" dict "file" . "root" $}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<span class="file gt-mono"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a>{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}</span>
|
||||||
|
<button class="btn interact-fg gt-p-3" data-clipboard-text="{{$file.Name}}">{{svg "octicon-copy" 14}}</button>
|
||||||
|
{{if $file.IsGenerated}}
|
||||||
|
<span class="ui label">{{$.locale.Tr "repo.diff.generated"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{if $file.IsVendored}}
|
||||||
|
<span class="ui label">{{$.locale.Tr "repo.diff.vendored"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{if and $file.Mode $file.OldMode}}
|
||||||
|
{{$old := $.locale.Tr ($file.ModeTranslationKey $file.OldMode)}}
|
||||||
|
{{$new := $.locale.Tr ($file.ModeTranslationKey $file.Mode)}}
|
||||||
|
<span class="gt-ml-4 gt-mono">{{$.locale.Tr "git.filemode.changed_filemode" $old $new}}</span>
|
||||||
|
{{else if $file.Mode}}
|
||||||
|
<span class="gt-ml-4 gt-mono">{{$.locale.Tr ($file.ModeTranslationKey $file.Mode)}}</span>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<div class="diff-file-header-actions gt-df gt-ac gt-gap-2 gt-fw">
|
||||||
|
{{if $showFileViewToggle}}
|
||||||
|
<div class="ui compact icon buttons">
|
||||||
|
<button class="ui tiny basic button file-view-toggle" data-toggle-selector="#diff-source-{{$file.NameHash}}" data-tooltip-content="{{$.locale.Tr "repo.file_view_source"}}">{{svg "octicon-code"}}</button>
|
||||||
|
<button class="ui tiny basic button file-view-toggle active" data-toggle-selector="#diff-rendered-{{$file.NameHash}}" data-tooltip-content="{{$.locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file"}}</button>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
{{if $file.IsProtected}}
|
||||||
|
<span class="ui basic label">{{$.locale.Tr "repo.diff.protected"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{if and $isReviewFile $file.HasChangedSinceLastReview}}
|
||||||
|
<span class="changed-since-last-review unselectable not-mobile">{{$.locale.Tr "repo.pulls.has_changed_since_last_review"}}</span>
|
||||||
|
{{end}}
|
||||||
|
{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
|
||||||
|
<button class="ui basic tiny button unescape-button not-mobile">{{$.locale.Tr "repo.unescape_control_characters"}}</button>
|
||||||
|
<button class="ui basic tiny button escape-button gt-hidden">{{$.locale.Tr "repo.escape_control_characters"}}</button>
|
||||||
|
{{end}}
|
||||||
|
{{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
|
||||||
|
{{if $file.IsDeleted}}
|
||||||
|
<a class="ui basic tiny button" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
|
||||||
|
{{else}}
|
||||||
|
<a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
{{if $isReviewFile}}
|
||||||
|
<label data-link="{{$.Issue.Link}}/viewed-files" data-headcommit="{{$.AfterCommitID}}" class="viewed-file-form unselectable{{if $file.IsViewed}} viewed-file-checked-form{{end}}">
|
||||||
|
<input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{$.locale.Tr "repo.pulls.has_viewed_file"}}
|
||||||
|
</label>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</h4>
|
||||||
|
<div class="diff-file-body ui attached unstackable table segment" {{if $file.IsViewed}}data-folded="true"{{end}}>
|
||||||
|
<div id="diff-source-{{$file.NameHash}}" class="file-body file-code unicode-escaped code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} gt-hidden{{end}}">
|
||||||
|
{{if or $file.IsIncomplete $file.IsBin}}
|
||||||
|
<div class="diff-file-body binary" style="padding: 5px 10px;">
|
||||||
|
{{if $file.IsIncomplete}}
|
||||||
|
{{if $file.IsIncompleteLineTooLong}}
|
||||||
|
{{$.locale.Tr "repo.diff.file_suppressed_line_too_long"}}
|
||||||
|
{{else}}
|
||||||
|
{{$.locale.Tr "repo.diff.file_suppressed"}}
|
||||||
|
<a class="ui basic tiny button diff-load-button" data-href="{{$.Link}}?file-only=true&files={{$file.Name}}&files={{$file.OldName}}">{{$.locale.Tr "repo.diff.load"}}</a>
|
||||||
|
{{end}}
|
||||||
|
{{else}}
|
||||||
|
{{$.locale.Tr "repo.diff.bin_not_shown"}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{else}}
|
||||||
|
<table class="chroma" data-new-comment-url="{{$.Issue.Link}}/files/reviews/new_comment" data-path="{{$file.Name}}">
|
||||||
|
{{if $.IsSplitStyle}}
|
||||||
|
{{template "repo/diff/section_split" dict "file" . "root" $}}
|
||||||
|
{{else}}
|
||||||
|
{{template "repo/diff/section_unified" dict "file" . "root" $}}
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{if $showFileViewToggle}}
|
||||||
|
{{/* for image or CSV, it can have a horizontal scroll bar, there won't be review comment context menu (position absolute) which would be clipped by "overflow" */}}
|
||||||
|
<div id="diff-rendered-{{$file.NameHash}}" class="file-body file-code {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}} gt-overflow-x-scroll">
|
||||||
|
<table class="chroma gt-w-100">
|
||||||
|
{{if $isImage}}
|
||||||
|
{{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}}
|
||||||
|
{{else}}
|
||||||
|
{{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}}
|
||||||
|
{{end}}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{if .Diff.IsIncomplete}}
|
||||||
|
<div class="diff-file-box diff-box file-content gt-mt-3" id="diff-incomplete">
|
||||||
|
<h4 class="ui top attached normal header gt-df gt-ac gt-sb">
|
||||||
|
{{$.locale.Tr "repo.diff.too_many_files"}}
|
||||||
|
<a class="ui basic tiny button" id="diff-show-more-files" data-href="{{$.Link}}?skip-to={{.Diff.End}}&file-only=true">{{.locale.Tr "repo.diff.show_more"}}</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}}
|
||||||
|
<template id="issue-comment-editor-template">
|
||||||
|
<div class="ui comment form">
|
||||||
|
{{template "shared/combomarkdowneditor" (dict
|
||||||
|
"locale" $.locale
|
||||||
|
"MarkdownPreviewUrl" (print $.Repository.Link "/markup")
|
||||||
|
"MarkdownPreviewContext" $.RepoLink
|
||||||
|
"TextareaName" "content"
|
||||||
|
"DropzoneParentContainer" ".ui.form"
|
||||||
|
)}}
|
||||||
|
<div class="text right edit buttons">
|
||||||
|
<button class="ui basic primary cancel button" tabindex="3">{{.locale.Tr "repo.issues.cancel"}}</button>
|
||||||
|
<button class="ui green save button" tabindex="2">{{.locale.Tr "repo.issues.save"}}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
{{end}}
|
||||||
|
{{if (not .DiffNotAvailable)}}
|
||||||
|
{{template "repo/issue/view_content/reference_issue_dialog" .}}
|
||||||
|
{{end}}
|
||||||
|
</div>
|
Loading…
x
Reference in New Issue
Block a user