diff --git a/public/css/index.css b/public/css/index.css index 7c881bb27..03a199d0b 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -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 .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} @@ -705,6 +703,11 @@ 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{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 3586eeccf..33ee5761c 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,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 { padding-top: 10px; padding-bottom: 10px; diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 0179af2a5..a12fc9bd4 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}}
@@ -32,17 +32,17 @@ {{end}}
-
    +
      {{range .Diff.Files}}
    1. {{if not .IsBin}} - {{.Addition}} + +{{.Addition}}
      - {{.Deletion}} + -{{.Deletion}} {{else}} {{$.i18n.Tr "repo.diff.bin"}} {{end}} @@ -53,188 +53,187 @@
    2. {{end}}
    -
- - {{range $i, $file := .Diff.Files}} - {{if $file.IsIncomplete}} -
-

-
- {{if not $file.IsRenamed}} - + {{.Addition}} - -
-
-
- - {{.Deletion}} + {{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}} -

- {{$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"}} +

+
+ {{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}} - {{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"}} - {{end}} - {{end}} -

-
- {{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}} - - - - - - - + +
+ {{if ne $file.Type 4}} + {{$isImage := false}} + {{if $file.IsDeleted}} + {{$isImage = (call $.IsImageFileInBase $file.Name)}} + {{else}} + {{$isImage = (call $.IsImageFileInHead $file.Name)}} + {{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)}} -
- {{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)}} -
- {{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}} + {{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)}} +
+ {{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)}} +
+ {{end}} +
-
- {{end}} + + +
+ {{end}} +
+ {{end}} +
+ {{end}} + + {{if .Diff.IsIncomplete}} +
+

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

{{end}} -
- {{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}}