mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 00:11:04 +00:00 
			
		
		
		
	Ensure that diff stats can scroll independently of the diff (#8581)
This PR ensures that once opened the diff stats detail box can be scrolled independently of the diff on the compare page. Fixes #5532 Details: * make diff-detail-box the main container * move file diff at the same level as diff-stats * make diff-view options sticy again * make diff-stats scroll if to mouch * rm useless css info * less: mv diff-stats to own class * use new css class * cleanup less file * diff-counter: margin-right: 15px; * make CI work * make numbers colorful * add sign (-/+) to numbers
This commit is contained in:
		
					parent
					
						
							
								b539a6e6e3
							
						
					
				
			
			
				commit
				
					
						b1c1e1549b
					
				
			
		
					 3 changed files with 206 additions and 191 deletions
				
			
		| 
						 | 
					@ -667,8 +667,6 @@ i.icon.centerlock{top:1.5em}
 | 
				
			||||||
.repository #commits-table td.sha .sha.label.isSigned.isVerified:hover,.repository #repo-files-table .sha.label.isSigned.isVerified:hover{background:rgba(33,186,69,.3)!important}
 | 
					.repository #commits-table td.sha .sha.label.isSigned.isVerified:hover,.repository #repo-files-table .sha.label.isSigned.isVerified:hover{background:rgba(33,186,69,.3)!important}
 | 
				
			||||||
.repository .diff-detail-box{padding:7px 0;background:#fff;line-height:30px}
 | 
					.repository .diff-detail-box{padding:7px 0;background:#fff;line-height:30px}
 | 
				
			||||||
.repository .diff-detail-box>div:after{clear:both;content:"";display:block}
 | 
					.repository .diff-detail-box>div:after{clear:both;content:"";display:block}
 | 
				
			||||||
.repository .diff-detail-box ol{clear:both;padding-left:0;margin-top:5px;margin-bottom:28px}
 | 
					 | 
				
			||||||
.repository .diff-detail-box ol li{list-style:none;padding-bottom:4px;margin-bottom:4px;border-bottom:1px dashed #ddd;padding-left:6px}
 | 
					 | 
				
			||||||
.repository .diff-detail-box span.status{display:inline-block;width:12px;height:12px;margin-right:8px;vertical-align:middle}
 | 
					.repository .diff-detail-box span.status{display:inline-block;width:12px;height:12px;margin-right:8px;vertical-align:middle}
 | 
				
			||||||
.repository .diff-detail-box span.status.modify{background-color:#f0db88}
 | 
					.repository .diff-detail-box span.status.modify{background-color:#f0db88}
 | 
				
			||||||
.repository .diff-detail-box span.status.add{background-color:#b4e2b4}
 | 
					.repository .diff-detail-box span.status.add{background-color:#b4e2b4}
 | 
				
			||||||
| 
						 | 
					@ -705,6 +703,11 @@ i.icon.centerlock{top:1.5em}
 | 
				
			||||||
.repository .diff-file-box.file-content{clear:right}
 | 
					.repository .diff-file-box.file-content{clear:right}
 | 
				
			||||||
.repository .diff-file-box.file-content img{max-width:100%;padding:5px 5px 0 5px}
 | 
					.repository .diff-file-box.file-content img{max-width:100%;padding:5px 5px 0 5px}
 | 
				
			||||||
.repository .diff-file-box.file-content img.emoji{padding:0}
 | 
					.repository .diff-file-box.file-content img.emoji{padding:0}
 | 
				
			||||||
 | 
					.repository .diff-stats{clear:both;margin-bottom:5px;max-height:400px;overflow:auto;padding-left:0}
 | 
				
			||||||
 | 
					.repository .diff-stats li{list-style:none;padding-bottom:4px;margin-bottom:4px;border-bottom:1px dashed #ddd;padding-left:6px}
 | 
				
			||||||
 | 
					.repository .diff-stats .diff-counter{margin-right:15px}
 | 
				
			||||||
 | 
					.repository .diff-stats .diff-counter .del{color:red}
 | 
				
			||||||
 | 
					.repository .diff-stats .diff-counter .add{color:green}
 | 
				
			||||||
.repository .repo-search-result{padding-top:10px;padding-bottom:10px}
 | 
					.repository .repo-search-result{padding-top:10px;padding-bottom:10px}
 | 
				
			||||||
.repository .repo-search-result .lines-num a{color:inherit}
 | 
					.repository .repo-search-result .lines-num a{color:inherit}
 | 
				
			||||||
.repository.quickstart .guide .item{padding:1em}
 | 
					.repository.quickstart .guide .item{padding:1em}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1246,21 +1246,6 @@
 | 
				
			||||||
            display: block;
 | 
					            display: block;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ol {
 | 
					 | 
				
			||||||
            clear: both;
 | 
					 | 
				
			||||||
            padding-left: 0;
 | 
					 | 
				
			||||||
            margin-top: 5px;
 | 
					 | 
				
			||||||
            margin-bottom: 28px;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            li {
 | 
					 | 
				
			||||||
                list-style: none;
 | 
					 | 
				
			||||||
                padding-bottom: 4px;
 | 
					 | 
				
			||||||
                margin-bottom: 4px;
 | 
					 | 
				
			||||||
                border-bottom: 1px dashed #dddddd;
 | 
					 | 
				
			||||||
                padding-left: 6px;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        span.status {
 | 
					        span.status {
 | 
				
			||||||
            display: inline-block;
 | 
					            display: inline-block;
 | 
				
			||||||
            width: 12px;
 | 
					            width: 12px;
 | 
				
			||||||
| 
						 | 
					@ -1475,6 +1460,34 @@
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .diff-stats {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        clear: both;
 | 
				
			||||||
 | 
					        margin-bottom: 5px;
 | 
				
			||||||
 | 
					        max-height: 400px;
 | 
				
			||||||
 | 
					        overflow: auto;
 | 
				
			||||||
 | 
					        padding-left: 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        li {
 | 
				
			||||||
 | 
					            list-style: none;
 | 
				
			||||||
 | 
					            padding-bottom: 4px;
 | 
				
			||||||
 | 
					            margin-bottom: 4px;
 | 
				
			||||||
 | 
					            border-bottom: 1px dashed #dddddd;
 | 
				
			||||||
 | 
					            padding-left: 6px;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        .diff-counter {
 | 
				
			||||||
 | 
					            margin-right: 15px;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            .del {
 | 
				
			||||||
 | 
					                color: red;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            .add {
 | 
				
			||||||
 | 
					                color: green;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    .repo-search-result {
 | 
					    .repo-search-result {
 | 
				
			||||||
        padding-top: 10px;
 | 
					        padding-top: 10px;
 | 
				
			||||||
        padding-bottom: 10px;
 | 
					        padding-bottom: 10px;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,8 +16,8 @@
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
	<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
 | 
						<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
 | 
				
			||||||
{{else}}
 | 
					{{else}}
 | 
				
			||||||
	<div class="diff-detail-box diff-box ui sticky">
 | 
						<div>
 | 
				
			||||||
		<div>
 | 
							<div class="diff-detail-box diff-box ui sticky">
 | 
				
			||||||
			<i class="fa fa-retweet"></i>
 | 
								<i class="fa fa-retweet"></i>
 | 
				
			||||||
			{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
 | 
								{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
 | 
				
			||||||
			<div class="ui right">
 | 
								<div class="ui right">
 | 
				
			||||||
| 
						 | 
					@ -32,17 +32,17 @@
 | 
				
			||||||
				{{end}}
 | 
									{{end}}
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
		<ol class="detail-files hide" id="diff-files">
 | 
							<ol class="diff-detail-box diff-stats detail-files hide" id="diff-files">
 | 
				
			||||||
			{{range .Diff.Files}}
 | 
								{{range .Diff.Files}}
 | 
				
			||||||
				<li>
 | 
									<li>
 | 
				
			||||||
					<div class="diff-counter count pull-right">
 | 
										<div class="diff-counter count pull-right">
 | 
				
			||||||
						{{if not .IsBin}}
 | 
											{{if not .IsBin}}
 | 
				
			||||||
							<span class="add" data-line="{{.Addition}}">{{.Addition}}</span>
 | 
												<span class="add" data-line="{{.Addition}}">+{{.Addition}}</span>
 | 
				
			||||||
							<span class="bar">
 | 
												<span class="bar">
 | 
				
			||||||
								<div class="pull-left add"></div>
 | 
													<div class="pull-left add"></div>
 | 
				
			||||||
								<div class="pull-left del"></div>
 | 
													<div class="pull-left del"></div>
 | 
				
			||||||
							</span>
 | 
												</span>
 | 
				
			||||||
							<span class="del" data-line="{{.Deletion}}">{{.Deletion}}</span>
 | 
												<span class="del" data-line="{{.Deletion}}">-{{.Deletion}}</span>
 | 
				
			||||||
						{{else}}
 | 
											{{else}}
 | 
				
			||||||
							<span>{{$.i18n.Tr "repo.diff.bin"}}</span>
 | 
												<span>{{$.i18n.Tr "repo.diff.bin"}}</span>
 | 
				
			||||||
						{{end}}
 | 
											{{end}}
 | 
				
			||||||
| 
						 | 
					@ -53,188 +53,187 @@
 | 
				
			||||||
				</li>
 | 
									</li>
 | 
				
			||||||
			{{end}}
 | 
								{{end}}
 | 
				
			||||||
		</ol>
 | 
							</ol>
 | 
				
			||||||
	</div>
 | 
							{{range $i, $file := .Diff.Files}}
 | 
				
			||||||
 | 
								{{if $file.IsIncomplete}}
 | 
				
			||||||
	{{range $i, $file := .Diff.Files}}
 | 
									<div class="diff-file-box diff-box file-content">
 | 
				
			||||||
		{{if $file.IsIncomplete}}
 | 
										<h4 class="ui top attached normal header rounded">
 | 
				
			||||||
			<div class="diff-file-box diff-box file-content">
 | 
											<div class="diff-counter count ui left">
 | 
				
			||||||
				<h4 class="ui top attached normal header rounded">
 | 
												{{if not $file.IsRenamed}}
 | 
				
			||||||
					<div class="diff-counter count ui left">
 | 
													<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
 | 
				
			||||||
						{{if not $file.IsRenamed}}
 | 
													<span class="bar">
 | 
				
			||||||
							<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
 | 
														<div class="pull-left add"></div>
 | 
				
			||||||
							<span class="bar">
 | 
														<div class="pull-left del"></div>
 | 
				
			||||||
								<div class="pull-left add"></div>
 | 
													</span>
 | 
				
			||||||
								<div class="pull-left del"></div>
 | 
													<span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
 | 
				
			||||||
							</span>
 | 
												{{end}}
 | 
				
			||||||
							<span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
 | 
											</div>
 | 
				
			||||||
 | 
											<span class="file">{{$file.Name}}</span>
 | 
				
			||||||
 | 
											<div>{{$.i18n.Tr "repo.diff.file_suppressed"}}</div>
 | 
				
			||||||
 | 
											{{if not $file.IsSubmodule}}
 | 
				
			||||||
 | 
												{{if $file.IsDeleted}}
 | 
				
			||||||
 | 
													<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
				
			||||||
 | 
												{{else}}
 | 
				
			||||||
 | 
													<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
				
			||||||
 | 
												{{end}}
 | 
				
			||||||
						{{end}}
 | 
											{{end}}
 | 
				
			||||||
					</div>
 | 
										</h4>
 | 
				
			||||||
					<span class="file">{{$file.Name}}</span>
 | 
									</div>
 | 
				
			||||||
					<div>{{$.i18n.Tr "repo.diff.file_suppressed"}}</div>
 | 
								{{else}}
 | 
				
			||||||
					{{if not $file.IsSubmodule}}
 | 
									<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
 | 
				
			||||||
						{{if $file.IsDeleted}}
 | 
										<h4 class="ui top attached normal header">
 | 
				
			||||||
							<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
											<div class="diff-counter count">
 | 
				
			||||||
						{{else}}
 | 
												{{if $file.IsBin}}
 | 
				
			||||||
							<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
													{{$.i18n.Tr "repo.diff.bin"}}
 | 
				
			||||||
 | 
												{{else if not $file.IsRenamed}}
 | 
				
			||||||
 | 
													<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
 | 
				
			||||||
 | 
													<span class="bar">
 | 
				
			||||||
 | 
														<div class="pull-left add"></div>
 | 
				
			||||||
 | 
														<div class="pull-left del"></div>
 | 
				
			||||||
 | 
													</span>
 | 
				
			||||||
 | 
													<span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
 | 
				
			||||||
 | 
												{{end}}
 | 
				
			||||||
 | 
											</div>
 | 
				
			||||||
 | 
											<span class="file">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}}</span>
 | 
				
			||||||
 | 
											{{if not $file.IsSubmodule}}
 | 
				
			||||||
 | 
												{{if $file.IsDeleted}}
 | 
				
			||||||
 | 
													<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
				
			||||||
 | 
												{{else}}
 | 
				
			||||||
 | 
													<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
				
			||||||
 | 
												{{end}}
 | 
				
			||||||
						{{end}}
 | 
											{{end}}
 | 
				
			||||||
					{{end}}
 | 
										</h4>
 | 
				
			||||||
				</h4>
 | 
										<div class="ui attached unstackable table segment">
 | 
				
			||||||
			</div>
 | 
											{{if ne $file.Type 4}}
 | 
				
			||||||
		{{else}}
 | 
												{{$isImage := false}}
 | 
				
			||||||
			<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
 | 
												{{if $file.IsDeleted}}
 | 
				
			||||||
				<h4 class="ui top attached normal header">
 | 
													{{$isImage = (call $.IsImageFileInBase $file.Name)}}
 | 
				
			||||||
					<div class="diff-counter count">
 | 
												{{else}}
 | 
				
			||||||
						{{if $file.IsBin}}
 | 
													{{$isImage = (call $.IsImageFileInHead $file.Name)}}
 | 
				
			||||||
							{{$.i18n.Tr "repo.diff.bin"}}
 | 
												{{end}}
 | 
				
			||||||
						{{else if not $file.IsRenamed}}
 | 
												<div class="file-body file-code code-view code-diff {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}}">
 | 
				
			||||||
							<span class="add" data-line="{{.Addition}}">+ {{.Addition}}</span>
 | 
													<table>
 | 
				
			||||||
							<span class="bar">
 | 
														<tbody>
 | 
				
			||||||
								<div class="pull-left add"></div>
 | 
															{{if $isImage}}
 | 
				
			||||||
								<div class="pull-left del"></div>
 | 
																{{template "repo/diff/image_diff" dict "file" . "root" $}}
 | 
				
			||||||
							</span>
 | 
															{{else}}
 | 
				
			||||||
							<span class="del" data-line="{{.Deletion}}">- {{.Deletion}}</span>
 | 
																{{if $.IsSplitStyle}}
 | 
				
			||||||
						{{end}}
 | 
																	{{$highlightClass := $file.GetHighlightClass}}
 | 
				
			||||||
					</div>
 | 
																	{{range $j, $section := $file.Sections}}
 | 
				
			||||||
					<span class="file">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}}</span>
 | 
																		{{range $k, $line := $section.Lines}}
 | 
				
			||||||
					{{if not $file.IsSubmodule}}
 | 
																			<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
 | 
				
			||||||
						{{if $file.IsDeleted}}
 | 
																				<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
 | 
				
			||||||
							<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.BeforeSourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
																				<td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
 | 
				
			||||||
						{{else}}
 | 
																				<td class="lines-code lines-code-old halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
 | 
				
			||||||
							<a class="ui basic grey tiny button" rel="nofollow" href="{{EscapePound $.SourcePath}}/{{EscapePound .Name}}">{{$.i18n.Tr "repo.diff.view_file"}}</a>
 | 
																				<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
 | 
				
			||||||
						{{end}}
 | 
																				<td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
 | 
				
			||||||
					{{end}}
 | 
																				<td class="lines-code lines-code-new halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
 | 
				
			||||||
				</h4>
 | 
					 | 
				
			||||||
				<div class="ui attached unstackable table segment">
 | 
					 | 
				
			||||||
					{{if ne $file.Type 4}}
 | 
					 | 
				
			||||||
						{{$isImage := false}}
 | 
					 | 
				
			||||||
						{{if $file.IsDeleted}}
 | 
					 | 
				
			||||||
							{{$isImage = (call $.IsImageFileInBase $file.Name)}}
 | 
					 | 
				
			||||||
						{{else}}
 | 
					 | 
				
			||||||
							{{$isImage = (call $.IsImageFileInHead $file.Name)}}
 | 
					 | 
				
			||||||
						{{end}}
 | 
					 | 
				
			||||||
						<div class="file-body file-code code-view code-diff {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}}">
 | 
					 | 
				
			||||||
							<table>
 | 
					 | 
				
			||||||
								<tbody>
 | 
					 | 
				
			||||||
									{{if $isImage}}
 | 
					 | 
				
			||||||
										{{template "repo/diff/image_diff" dict "file" . "root" $}}
 | 
					 | 
				
			||||||
									{{else}}
 | 
					 | 
				
			||||||
										{{if $.IsSplitStyle}}
 | 
					 | 
				
			||||||
											{{$highlightClass := $file.GetHighlightClass}}
 | 
					 | 
				
			||||||
											{{range $j, $section := $file.Sections}}
 | 
					 | 
				
			||||||
												{{range $k, $line := $section.Lines}}
 | 
					 | 
				
			||||||
													<tr class="{{DiffLineTypeToStr .GetType}}-code nl-{{$k}} ol-{{$k}}">
 | 
					 | 
				
			||||||
														<td class="lines-num lines-num-old" data-line-num="{{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}}"><span rel="{{if $line.LeftIdx}}diff-{{Sha1 $file.Name}}L{{$line.LeftIdx}}{{end}}"></span></td>
 | 
					 | 
				
			||||||
														<td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
 | 
					 | 
				
			||||||
														<td class="lines-code lines-code-old halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}<a class="ui green button add-code-comment add-code-comment-left" data-path="{{$file.Name}}" data-side="left" data-idx="{{$line.LeftIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
 | 
					 | 
				
			||||||
														<td class="lines-num lines-num-new" data-line-num="{{if $line.RightIdx}}{{$line.RightIdx}}{{end}}"><span rel="{{if $line.RightIdx}}diff-{{Sha1 $file.Name}}R{{$line.RightIdx}}{{end}}"></span></td>
 | 
					 | 
				
			||||||
														<td class="lines-type-marker lines-type-marker-new">{{if $line.RightIdx}}<span class="mono" data-type-marker="{{$line.GetLineTypeMarker}}"></span>{{end}}</td>
 | 
					 | 
				
			||||||
														<td class="lines-code lines-code-new halfwidth">{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}<a class="ui green button add-code-comment add-code-comment-right" data-path="{{$file.Name}}" data-side="right" data-idx="{{$line.RightIdx}}">+</a>{{end}}<span class="mono wrap{{if $highlightClass}} language-{{$highlightClass}}{{else}} nohighlight{{end}}">{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}</span></td>
 | 
					 | 
				
			||||||
													</tr>
 | 
					 | 
				
			||||||
													{{if gt (len $line.Comments) 0}}
 | 
					 | 
				
			||||||
														<tr class="add-code-comment">
 | 
					 | 
				
			||||||
															<td class="lines-num"></td>
 | 
					 | 
				
			||||||
															<td class="lines-type-marker"></td>
 | 
					 | 
				
			||||||
															<td class="add-comment-left">
 | 
					 | 
				
			||||||
																{{if eq $line.GetCommentSide "previous"}}
 | 
					 | 
				
			||||||
																	<div class="field comment-code-cloud">
 | 
					 | 
				
			||||||
																		<div class="comment-list">
 | 
					 | 
				
			||||||
																			<ui class="ui comments">
 | 
					 | 
				
			||||||
																			{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
 | 
					 | 
				
			||||||
																			</ui>
 | 
					 | 
				
			||||||
																		</div>
 | 
					 | 
				
			||||||
																	{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
 | 
					 | 
				
			||||||
																	</div>
 | 
					 | 
				
			||||||
																{{end}}
 | 
					 | 
				
			||||||
															</td>
 | 
					 | 
				
			||||||
															<td class="lines-num"></td>
 | 
					 | 
				
			||||||
															<td class="lines-type-marker"></td>
 | 
					 | 
				
			||||||
															<td class="add-comment-right">
 | 
					 | 
				
			||||||
																{{if eq $line.GetCommentSide "proposed"}}
 | 
					 | 
				
			||||||
																	<div class="field comment-code-cloud">
 | 
					 | 
				
			||||||
																		<div class="comment-list">
 | 
					 | 
				
			||||||
																			<ui class="ui comments">
 | 
					 | 
				
			||||||
																			{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
 | 
					 | 
				
			||||||
																			</ui>
 | 
					 | 
				
			||||||
																		</div>
 | 
					 | 
				
			||||||
																		{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
 | 
					 | 
				
			||||||
																	</div>
 | 
					 | 
				
			||||||
																{{end}}
 | 
					 | 
				
			||||||
															</td>
 | 
					 | 
				
			||||||
														</tr>
 | 
																			</tr>
 | 
				
			||||||
 | 
																			{{if gt (len $line.Comments) 0}}
 | 
				
			||||||
 | 
																				<tr class="add-code-comment">
 | 
				
			||||||
 | 
																					<td class="lines-num"></td>
 | 
				
			||||||
 | 
																					<td class="lines-type-marker"></td>
 | 
				
			||||||
 | 
																					<td class="add-comment-left">
 | 
				
			||||||
 | 
																						{{if eq $line.GetCommentSide "previous"}}
 | 
				
			||||||
 | 
																							<div class="field comment-code-cloud">
 | 
				
			||||||
 | 
																								<div class="comment-list">
 | 
				
			||||||
 | 
																									<ui class="ui comments">
 | 
				
			||||||
 | 
																									{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
 | 
				
			||||||
 | 
																									</ui>
 | 
				
			||||||
 | 
																								</div>
 | 
				
			||||||
 | 
																							{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
 | 
				
			||||||
 | 
																							</div>
 | 
				
			||||||
 | 
																						{{end}}
 | 
				
			||||||
 | 
																					</td>
 | 
				
			||||||
 | 
																					<td class="lines-num"></td>
 | 
				
			||||||
 | 
																					<td class="lines-type-marker"></td>
 | 
				
			||||||
 | 
																					<td class="add-comment-right">
 | 
				
			||||||
 | 
																						{{if eq $line.GetCommentSide "proposed"}}
 | 
				
			||||||
 | 
																							<div class="field comment-code-cloud">
 | 
				
			||||||
 | 
																								<div class="comment-list">
 | 
				
			||||||
 | 
																									<ui class="ui comments">
 | 
				
			||||||
 | 
																									{{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}}
 | 
				
			||||||
 | 
																									</ui>
 | 
				
			||||||
 | 
																								</div>
 | 
				
			||||||
 | 
																								{{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
 | 
				
			||||||
 | 
																							</div>
 | 
				
			||||||
 | 
																						{{end}}
 | 
				
			||||||
 | 
																					</td>
 | 
				
			||||||
 | 
																				</tr>
 | 
				
			||||||
 | 
																			{{end}}
 | 
				
			||||||
													{{end}}
 | 
																		{{end}}
 | 
				
			||||||
												{{end}}
 | 
																	{{end}}
 | 
				
			||||||
 | 
																{{else}}
 | 
				
			||||||
 | 
																	{{template "repo/diff/section_unified" dict "file" . "root" $}}
 | 
				
			||||||
											{{end}}
 | 
																{{end}}
 | 
				
			||||||
										{{else}}
 | 
					 | 
				
			||||||
											{{template "repo/diff/section_unified" dict "file" . "root" $}}
 | 
					 | 
				
			||||||
										{{end}}
 | 
															{{end}}
 | 
				
			||||||
									{{end}}
 | 
														</tbody>
 | 
				
			||||||
								</tbody>
 | 
													</table>
 | 
				
			||||||
							</table>
 | 
												</div>
 | 
				
			||||||
						</div>
 | 
											{{end}}
 | 
				
			||||||
					{{end}}
 | 
										</div>
 | 
				
			||||||
				</div>
 | 
									</div>
 | 
				
			||||||
 | 
								{{end}}
 | 
				
			||||||
 | 
							<br>
 | 
				
			||||||
 | 
							{{end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							{{if .Diff.IsIncomplete}}
 | 
				
			||||||
 | 
								<div class="diff-file-box diff-box file-content">
 | 
				
			||||||
 | 
									<h4 class="ui top attached normal header">
 | 
				
			||||||
 | 
										{{$.i18n.Tr "repo.diff.too_many_files"}}
 | 
				
			||||||
 | 
									</h4>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
		{{end}}
 | 
							{{end}}
 | 
				
			||||||
	<br>
 | 
					 | 
				
			||||||
	{{end}}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{{if .Diff.IsIncomplete}}
 | 
							{{if not $.Repository.IsArchived}}
 | 
				
			||||||
		<div class="diff-file-box diff-box file-content">
 | 
								<div id="pull_review_add_comment" class="hide">
 | 
				
			||||||
			<h4 class="ui top attached normal header">
 | 
										{{template "repo/diff/new_comment" dict "root" .}}
 | 
				
			||||||
				{{$.i18n.Tr "repo.diff.too_many_files"}}
 | 
										</div>
 | 
				
			||||||
			</h4>
 | 
										<div class="hide" id="edit-content-form">
 | 
				
			||||||
		</div>
 | 
												<div class="ui comment form">
 | 
				
			||||||
	{{end}}
 | 
														<div class="ui top attached tabular menu">
 | 
				
			||||||
 | 
																<a class="active write item">{{$.i18n.Tr "write"}}</a>
 | 
				
			||||||
 | 
																<a class="preview item" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
														<div class="ui bottom attached active write tab segment">
 | 
				
			||||||
 | 
																<textarea tabindex="1" name="content"></textarea>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
														<div class="ui bottom attached tab preview segment markdown">
 | 
				
			||||||
 | 
														{{$.i18n.Tr "loading"}}
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
														<div class="text right edit buttons">
 | 
				
			||||||
 | 
																<div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
 | 
				
			||||||
 | 
																<div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
 | 
				
			||||||
 | 
														</div>
 | 
				
			||||||
 | 
												</div>
 | 
				
			||||||
 | 
										</div>
 | 
				
			||||||
 | 
							 {{end}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{{if not $.Repository.IsArchived}}
 | 
							{{if .IsSplitStyle}}
 | 
				
			||||||
		<div id="pull_review_add_comment" class="hide">
 | 
								<script>
 | 
				
			||||||
		    {{template "repo/diff/new_comment" dict "root" .}}
 | 
									document.addEventListener('DOMContentLoaded', function() {
 | 
				
			||||||
        </div>
 | 
										$('tr.add-code').each(function() {
 | 
				
			||||||
        <div class="hide" id="edit-content-form">
 | 
											var prev = $(this).prev();
 | 
				
			||||||
            <div class="ui comment form">
 | 
											if(prev.is('.del-code') && prev.children().eq(5).text().trim() === '') {
 | 
				
			||||||
                <div class="ui top attached tabular menu">
 | 
												while(prev.prev().is('.del-code') && prev.prev().children().eq(5).text().trim() === '') {
 | 
				
			||||||
                    <a class="active write item">{{$.i18n.Tr "write"}}</a>
 | 
													prev = prev.prev();
 | 
				
			||||||
                    <a class="preview item" data-url="{{$.Repository.APIURL}}/markdown" data-context="{{$.RepoLink}}">{{$.i18n.Tr "preview"}}</a>
 | 
												}
 | 
				
			||||||
                </div>
 | 
												prev.children().eq(3).attr("data-line-num", $(this).children().eq(3).attr("data-line-num"));
 | 
				
			||||||
                <div class="ui bottom attached active write tab segment">
 | 
												prev.children().eq(3).html($(this).children().eq(3).html());
 | 
				
			||||||
                    <textarea tabindex="1" name="content"></textarea>
 | 
												prev.children().eq(4).html($(this).children().eq(4).html());
 | 
				
			||||||
                </div>
 | 
												prev.children().eq(5).html($(this).children().eq(5).html());
 | 
				
			||||||
                <div class="ui bottom attached tab preview segment markdown">
 | 
					 | 
				
			||||||
                {{$.i18n.Tr "loading"}}
 | 
					 | 
				
			||||||
                </div>
 | 
					 | 
				
			||||||
                <div class="text right edit buttons">
 | 
					 | 
				
			||||||
                    <div class="ui basic blue cancel button" tabindex="3">{{.i18n.Tr "repo.issues.cancel"}}</div>
 | 
					 | 
				
			||||||
                    <div class="ui green save button" tabindex="2">{{.i18n.Tr "repo.issues.save"}}</div>
 | 
					 | 
				
			||||||
                </div>
 | 
					 | 
				
			||||||
            </div>
 | 
					 | 
				
			||||||
        </div>
 | 
					 | 
				
			||||||
	 {{end}}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{{if .IsSplitStyle}}
 | 
												prev.children().eq(0).addClass('del-code');
 | 
				
			||||||
		<script>
 | 
												prev.children().eq(1).addClass('del-code');
 | 
				
			||||||
			document.addEventListener('DOMContentLoaded', function() {
 | 
												prev.children().eq(2).addClass('del-code');
 | 
				
			||||||
				$('tr.add-code').each(function() {
 | 
												prev.children().eq(3).addClass('add-code');
 | 
				
			||||||
					var prev = $(this).prev();
 | 
												prev.children().eq(4).addClass('add-code');
 | 
				
			||||||
					if(prev.is('.del-code') && prev.children().eq(5).text().trim() === '') {
 | 
												prev.children().eq(5).addClass('add-code');
 | 
				
			||||||
						while(prev.prev().is('.del-code') && prev.prev().children().eq(5).text().trim() === '') {
 | 
					
 | 
				
			||||||
							prev = prev.prev();
 | 
												$(this).remove();
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						prev.children().eq(3).attr("data-line-num", $(this).children().eq(3).attr("data-line-num"));
 | 
										});
 | 
				
			||||||
						prev.children().eq(3).html($(this).children().eq(3).html());
 | 
					 | 
				
			||||||
						prev.children().eq(4).html($(this).children().eq(4).html());
 | 
					 | 
				
			||||||
						prev.children().eq(5).html($(this).children().eq(5).html());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
						prev.children().eq(0).addClass('del-code');
 | 
					 | 
				
			||||||
						prev.children().eq(1).addClass('del-code');
 | 
					 | 
				
			||||||
						prev.children().eq(2).addClass('del-code');
 | 
					 | 
				
			||||||
						prev.children().eq(3).addClass('add-code');
 | 
					 | 
				
			||||||
						prev.children().eq(4).addClass('add-code');
 | 
					 | 
				
			||||||
						prev.children().eq(5).addClass('add-code');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
						$(this).remove();
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			});
 | 
								</script>
 | 
				
			||||||
		</script>
 | 
							{{end}}
 | 
				
			||||||
	{{end}}
 | 
						</div>
 | 
				
			||||||
{{end}}
 | 
					{{end}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue