From bd5d464a58a85c9118a4c9534a3a3cc2359505d4 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 14:59:34 +0200 Subject: [PATCH 01/12] make diff-detail-box the main container --- templates/repo/diff/box.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 0179af2a515f..51c5971e54a6 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -16,7 +16,7 @@

{{.i18n.Tr "repo.diff.data_not_available"}}

{{else}} -
+
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} From 06afff1fe220c7af01010509959a00aea85d3e62 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:00:11 +0200 Subject: [PATCH 02/12] move file diff at the same level as diff-stats --- templates/repo/diff/box.tmpl | 335 +++++++++++++++++------------------ 1 file changed, 167 insertions(+), 168 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 51c5971e54a6..7da1f7260afb 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -53,188 +53,187 @@ {{end}} -
- - {{range $i, $file := .Diff.Files}} - {{if $file.IsIncomplete}} -
-

-
- {{if not $file.IsRenamed}} - + {{.Addition}} - -
-
-
- - {{.Deletion}} - {{end}} -
- {{$file.Name}} -
{{$.i18n.Tr "repo.diff.file_suppressed"}}
- {{if not $file.IsSubmodule}} - {{if $file.IsDeleted}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{else}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{end}} - {{end}} -

-
- {{else}} -
-

-
- {{if $file.IsBin}} - {{$.i18n.Tr "repo.diff.bin"}} - {{else if not $file.IsRenamed}} - + {{.Addition}} - -
-
-
- - {{.Deletion}} - {{end}} -
- {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}} - {{if not $file.IsSubmodule}} - {{if $file.IsDeleted}} - {{$.i18n.Tr "repo.diff.view_file"}} - {{else}} - {{$.i18n.Tr "repo.diff.view_file"}} + {{range $i, $file := .Diff.Files}} + {{if $file.IsIncomplete}} +
+

+
+ {{if not $file.IsRenamed}} + + {{.Addition}} + +
+
+
+ - {{.Deletion}} + {{end}} +
+ {{$file.Name}} +
{{$.i18n.Tr "repo.diff.file_suppressed"}}
+ {{if not $file.IsSubmodule}} + {{if $file.IsDeleted}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{else}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{end}} {{end}} - {{end}} -

-
- {{if ne $file.Type 4}} - {{$isImage := false}} - {{if $file.IsDeleted}} - {{$isImage = (call $.IsImageFileInBase $file.Name)}} - {{else}} - {{$isImage = (call $.IsImageFileInHead $file.Name)}} +

+
+ {{else}} +
+

+
+ {{if $file.IsBin}} + {{$.i18n.Tr "repo.diff.bin"}} + {{else if not $file.IsRenamed}} + + {{.Addition}} + +
+
+
+ - {{.Deletion}} + {{end}} +
+ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.i18n.Tr "repo.stored_lfs"}}){{end}} + {{if not $file.IsSubmodule}} + {{if $file.IsDeleted}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{else}} + {{$.i18n.Tr "repo.diff.view_file"}} + {{end}} {{end}} -
- - - {{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}} - - - - - - - - - {{if gt (len $line.Comments) 0}} - - - - +
{{if $line.LeftIdx}}{{end}}{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}+{{end}}{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}{{if $line.RightIdx}}{{end}}{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}+{{end}}{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}
- {{if eq $line.GetCommentSide "previous"}} -
-
- - {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} - + +
+ {{if ne $file.Type 4}} + {{$isImage := false}} + {{if $file.IsDeleted}} + {{$isImage = (call $.IsImageFileInBase $file.Name)}} + {{else}} + {{$isImage = (call $.IsImageFileInHead $file.Name)}} + {{end}} +
+ + + {{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}} + + + + + + + + + {{if gt (len $line.Comments) 0}} + + + + - - - + + + - + {{end}} + + + {{end}} {{end}} {{end}} + {{else}} + {{template "repo/diff/section_unified" dict "file" . "root" $}} {{end}} - {{else}} - {{template "repo/diff/section_unified" dict "file" . "root" $}} {{end}} - {{end}} - -
{{if $line.LeftIdx}}{{end}}{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 2))}}+{{end}}{{if $line.LeftIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}{{if $line.RightIdx}}{{end}}{{if and $.SignedUserID $line.CanComment $.PageIsPullFiles (not (eq .GetType 3))}}+{{end}}{{if $line.RightIdx}}{{$section.GetComputedInlineDiffFor $line}}{{end}}
+ {{if eq $line.GetCommentSide "previous"}} +
+
+ + {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} + +
+ {{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
- {{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}} - - {{end}} -
- {{if eq $line.GetCommentSide "proposed"}} -
-
- - {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} - + {{end}} +
+ {{if eq $line.GetCommentSide "proposed"}} +
+
+ + {{ template "repo/diff/comments" dict "root" $ "comments" $line.Comments}} + +
+ {{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}}
- {{template "repo/diff/comment_form_datahandler" dict "reply" (index $line.Comments 0).ReviewID "hidden" true "root" $ "comment" (index $line.Comments 0)}} - - {{end}} -
-
- {{end}} +
+
+ {{end}} +

-
+ {{end}} +
{{end}} -
- {{end}} - {{if .Diff.IsIncomplete}} -
-

- {{$.i18n.Tr "repo.diff.too_many_files"}} -

-
- {{end}} + {{if .Diff.IsIncomplete}} +
+

+ {{$.i18n.Tr "repo.diff.too_many_files"}} +

+
+ {{end}} - {{if not $.Repository.IsArchived}} -
- {{template "repo/diff/new_comment" dict "root" .}} -
-
-
- -
- -
-
- {{$.i18n.Tr "loading"}} -
-
-
{{.i18n.Tr "repo.issues.cancel"}}
-
{{.i18n.Tr "repo.issues.save"}}
-
-
-
- {{end}} + {{if not $.Repository.IsArchived}} +
+ {{template "repo/diff/new_comment" dict "root" .}} +
+
+
+ +
+ +
+
+ {{$.i18n.Tr "loading"}} +
+
+
{{.i18n.Tr "repo.issues.cancel"}}
+
{{.i18n.Tr "repo.issues.save"}}
+
+
+
+ {{end}} - {{if .IsSplitStyle}} - - {{end}} + + {{end}} + {{end}} From bc050840e2c141a6d1a269c4c87ea77255b3f8a5 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:08:51 +0200 Subject: [PATCH 03/12] make diff-view options sticy again --- templates/repo/diff/box.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 7da1f7260afb..f92754aabcac 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -16,8 +16,8 @@

{{.i18n.Tr "repo.diff.data_not_available"}}

{{else}} -
-
+
+
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
From fc4b006cd1c244b564380fd71402929528986c31 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:09:36 +0200 Subject: [PATCH 04/12] make diff-stats scroll if to mouch --- templates/repo/diff/box.tmpl | 44 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index f92754aabcac..2e18f759c83a 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -32,27 +32,29 @@ {{end}}
-
    - {{range .Diff.Files}} -
  1. -
    - {{if not .IsBin}} - {{.Addition}} - -
    -
    -
    - {{.Deletion}} - {{else}} - {{$.i18n.Tr "repo.diff.bin"}} - {{end}} -
    - -   - {{.Name}} -
  2. - {{end}} -
+
+
    + {{range .Diff.Files}} +
  1. +
    + {{if not .IsBin}} + {{.Addition}} + +
    +
    +
    + {{.Deletion}} + {{else}} + {{$.i18n.Tr "repo.diff.bin"}} + {{end}} +
    + +   + {{.Name}} +
  2. + {{end}} +
+
{{range $i, $file := .Diff.Files}} {{if $file.IsIncomplete}}
From c373be0e0edd29b81c851852da9ebb3996cfde14 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:31:08 +0200 Subject: [PATCH 05/12] rm useless css info --- templates/repo/diff/box.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 2e18f759c83a..c6eee93b4e55 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -16,7 +16,7 @@

{{.i18n.Tr "repo.diff.data_not_available"}}

{{else}} -
+
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}} From c0877e39bde4e431cc907415d9afa2948fde0de1 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:49:00 +0200 Subject: [PATCH 06/12] less: mv diff-stats to own class --- public/css/index.css | 5 +++-- public/less/_repository.less | 37 +++++++++++++++++++++--------------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/public/css/index.css b/public/css/index.css index 6fdcb5c22583..a8041c9d32cc 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -665,8 +665,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 .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 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.modify{background-color:#f0db88} .repository .diff-detail-box span.status.add{background-color:#b4e2b4} @@ -703,6 +701,9 @@ i.icon.centerlock{top:1.5em} .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.emoji{padding:0} +.repository .diff-stats{max-height:400px;overflow:auto;margin-bottom:5px} +.repository .diff-stats ol{clear:both;padding-left:0;margin-top:5px;margin-bottom:28px} +.repository .diff-stats ol li{list-style:none;padding-bottom:4px;margin-bottom:4px;border-bottom:1px dashed #ddd;padding-left:6px} .repository .repo-search-result{padding-top:10px;padding-bottom:10px} .repository .repo-search-result .lines-num a{color:inherit} .repository.quickstart .guide .item{padding:1em} diff --git a/public/less/_repository.less b/public/less/_repository.less index 3586eeccf0a6..388c7655b0b3 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1246,21 +1246,6 @@ 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 { display: inline-block; width: 12px; @@ -1475,6 +1460,28 @@ } } + .diff-stats { + + max-height: 400px; + overflow: auto; + margin-bottom: 5px; + + 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; + } + } + } + .repo-search-result { padding-top: 10px; padding-bottom: 10px; From e06c095e26fa13f311f3f364e759197e07dfa44e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:49:28 +0200 Subject: [PATCH 07/12] use new css class --- templates/repo/diff/box.tmpl | 44 +++++++++++++++++------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index c6eee93b4e55..bce527812380 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -32,29 +32,27 @@ {{end}}
-
-
    - {{range .Diff.Files}} -
  1. -
    - {{if not .IsBin}} - {{.Addition}} - -
    -
    -
    - {{.Deletion}} - {{else}} - {{$.i18n.Tr "repo.diff.bin"}} - {{end}} -
    - -   - {{.Name}} -
  2. - {{end}} -
-
+
    + {{range .Diff.Files}} +
  1. +
    + {{if not .IsBin}} + {{.Addition}} + +
    +
    +
    + {{.Deletion}} + {{else}} + {{$.i18n.Tr "repo.diff.bin"}} + {{end}} +
    + +   + {{.Name}} +
  2. + {{end}} +
{{range $i, $file := .Diff.Files}} {{if $file.IsIncomplete}}
From ebc6aa54670aa66ac452048941244cd9a5fc21ce Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 15:59:55 +0200 Subject: [PATCH 08/12] cleanup less file --- public/css/index.css | 5 ++--- public/less/_repository.less | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/public/css/index.css b/public/css/index.css index a8041c9d32cc..89d460a2f5d6 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -701,9 +701,8 @@ i.icon.centerlock{top:1.5em} .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.emoji{padding:0} -.repository .diff-stats{max-height:400px;overflow:auto;margin-bottom:5px} -.repository .diff-stats ol{clear:both;padding-left:0;margin-top:5px;margin-bottom:28px} -.repository .diff-stats ol li{list-style:none;padding-bottom:4px;margin-bottom:4px;border-bottom:1px dashed #ddd;padding-left:6px} +.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 .repo-search-result{padding-top:10px;padding-bottom:10px} .repository .repo-search-result .lines-num a{color:inherit} .repository.quickstart .guide .item{padding:1em} diff --git a/public/less/_repository.less b/public/less/_repository.less index 388c7655b0b3..38d82dae106a 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1462,23 +1462,18 @@ .diff-stats { + clear: both; + margin-bottom: 5px; max-height: 400px; overflow: auto; - margin-bottom: 5px; + padding-left: 0; - 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; - } + li { + list-style: none; + padding-bottom: 4px; + margin-bottom: 4px; + border-bottom: 1px dashed #dddddd; + padding-left: 6px; } } From 0a954b89dd30f830f4fe7b9c9d03c9981890006e Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 18 Oct 2019 18:59:06 +0200 Subject: [PATCH 09/12] diff-counter: margin-right: 15px; --- public/css/index.css | 1 + public/less/_repository.less | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/public/css/index.css b/public/css/index.css index 2c3af85284f4..1ea97e4e7794 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -705,6 +705,7 @@ i.icon.centerlock{top:1.5em} .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 .repo-search-result{padding-top:10px;padding-bottom:10px} .repository .repo-search-result .lines-num a{color:inherit} .repository.quickstart .guide .item{padding:1em} diff --git a/public/less/_repository.less b/public/less/_repository.less index 38d82dae106a..68be9cae242c 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1475,6 +1475,10 @@ border-bottom: 1px dashed #dddddd; padding-left: 6px; } + + .diff-counter { + margin-right: 15px; + } } .repo-search-result { From 47c5f2c4deb663928d3205f864b5684782b995ba Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 19 Oct 2019 04:53:46 +0200 Subject: [PATCH 10/12] make CI work From 081167e02b1280aa02b75449c1f90ef06e67dcfb Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 21 Oct 2019 02:50:07 +0200 Subject: [PATCH 11/12] make numbers collorful --- public/css/index.css | 2 ++ public/less/_repository.less | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/public/css/index.css b/public/css/index.css index 1ea97e4e7794..03a199d0b9af 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -706,6 +706,8 @@ i.icon.centerlock{top:1.5em} .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 .lines-num a{color:inherit} .repository.quickstart .guide .item{padding:1em} diff --git a/public/less/_repository.less b/public/less/_repository.less index 68be9cae242c..33ee5761c40d 100644 --- a/public/less/_repository.less +++ b/public/less/_repository.less @@ -1478,6 +1478,13 @@ .diff-counter { margin-right: 15px; + + .del { + color: red; + } + .add { + color: green; + } } } From ace2ae0a584547f4b9e807c4a540e14648c53bd2 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 21 Oct 2019 02:52:57 +0200 Subject: [PATCH 12/12] add sign (-/+) to nubers --- templates/repo/diff/box.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index bce527812380..a12fc9bd4b71 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -37,12 +37,12 @@
  • {{if not .IsBin}} - {{.Addition}} + +{{.Addition}}
    - {{.Deletion}} + -{{.Deletion}} {{else}} {{$.i18n.Tr "repo.diff.bin"}} {{end}}