From 5589445557b512e5f8f6b2930ab0f15dcf624bfb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 3 Feb 2015 12:42:34 -0500 Subject: [PATCH 1/4] scripts: remove confuse scripts --- scripts/start.bat | 2 -- scripts/start.sh | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 scripts/start.bat diff --git a/scripts/start.bat b/scripts/start.bat deleted file mode 100644 index dfe84c0f..00000000 --- a/scripts/start.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -..\\gogs.exe web diff --git a/scripts/start.sh b/scripts/start.sh index 997b5fc2..9c05dc97 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -3,7 +3,7 @@ # Use of this source code is governed by a MIT-style # license that can be found in the LICENSE file. # -# start gogs web +# MUST EXECUTE THIS AT ROOT DIRECTORY: ./scripts/start.sh # IFS=' ' From 7f71fe9dae05d11c51ee5009580c14c47edf5043 Mon Sep 17 00:00:00 2001 From: Alexey Makhov Date: Tue, 3 Feb 2015 23:53:34 +0300 Subject: [PATCH 2/4] fix diff lines highlighting --- public/ng/js/gogs.js | 21 ++++++++++++++------- public/ng/less/gogs/repository.less | 3 +++ templates/repo/diff.tmpl | 10 +++++----- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index f0bb7633..47c2e38f 100644 --- a/public/ng/js/gogs.js +++ b/public/ng/js/gogs.js @@ -141,6 +141,7 @@ var Gogs = {}; Gogs.renderCodeView = function () { function selectRange($list, $select, $from) { $list.removeClass('active'); + $list.parents('tr').find('td').removeClass('selected-line'); if ($from) { var a = parseInt($select.attr('rel').substr(1)); var b = parseInt($from.attr('rel').substr(1)); @@ -153,21 +154,27 @@ var Gogs = {}; } var classes = []; for (i = a; i <= b; i++) { - classes.push('.L' + i); + classes.push('[rel=L' + i + ']'); } $list.filter(classes.join(',')).addClass('active'); + $list.filter(classes.join(',')).parents('tr').find('td').addClass('selected-line'); $.changeHash('#L' + a + '-' + 'L' + b); return } } $select.addClass('active'); + $select.parents('tr').find('td').addClass('selected-line'); $.changeHash('#' + $select.attr('rel')); } $(document).on('click', '.lines-num span', function (e) { var $select = $(this); - var $list = $select.parent().siblings('.lines-code').find('ol.linenums > li'); - selectRange($list, $list.filter('[rel=' + $select.attr('rel') + ']'), (e.shiftKey ? $list.filter('.active').eq(0) : null)); + var $list = $select.parent().siblings('.lines-code').parents().find('td.lines-num > span'); + selectRange( + $list, + $list.filter('[rel=' + $select.attr('rel') + ']'), + (e.shiftKey && $list.filter('.active').length ? $list.filter('.active').eq(0) : null) + ); $.deSelect(); }); @@ -185,17 +192,17 @@ var Gogs = {}; $(window).on('hashchange', function (e) { var m = window.location.hash.match(/^#(L\d+)\-(L\d+)$/); - var $list = $('.code-view ol.linenums > li'); + var $list = $('.code-view td.lines-num > span'); var $first; if (m) { - $first = $list.filter('.' + m[1]); - selectRange($list, $first, $list.filter('.' + m[2])); + $first = $list.filter('[rel=' + m[1] + ']'); + selectRange($list, $first, $list.filter('[rel=' + m[2] + ']')); $("html, body").scrollTop($first.offset().top - 200); return; } m = window.location.hash.match(/^#(L\d+)$/); if (m) { - $first = $list.filter('.' + m[1]); + $first = $list.filter('[rel=' + m[1] + ']'); selectRange($list, $first); $("html, body").scrollTop($first.offset().top - 200); } diff --git a/public/ng/less/gogs/repository.less b/public/ng/less/gogs/repository.less index 29178429..e48f5c87 100644 --- a/public/ng/less/gogs/repository.less +++ b/public/ng/less/gogs/repository.less @@ -665,6 +665,9 @@ background-color: #d1ffd6 !important; border-color: #b4e2b4 !important; } + td.selected-line, td.selected-line pre { + background-color: #ffffdd !important; + } } &:hover { td, pre { diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 80453516..8becb006 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -102,17 +102,17 @@ {{range .Sections}} - {{range .Lines}} - + {{range $i, $line := .Lines}} + {{end}} From 5d4425bbbc8a6747f53e488d230dbae33ebd935e Mon Sep 17 00:00:00 2001 From: Alexey Makhov Date: Wed, 4 Feb 2015 21:54:45 +0300 Subject: [PATCH 3/4] add multifile support to diff view highlighting --- templates/repo/diff.tmpl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 8becb006..13b78a38 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -74,11 +74,11 @@ - {{range .Diff.Files}} + {{range $i, $file := .Diff.Files}}
- {{if not .IsBin}} + {{if not $file.IsBin}} + {{.Addition}} @@ -90,9 +90,9 @@ {{end}}
{{$.i18n.Tr "repo.diff.view_file"}} - {{.Name}} + {{$file.Name}}
- {{$isImage := (call $.IsImageFile .Name)}} + {{$isImage := (call $.IsImageFile $file.Name)}}
{{if $isImage}}
@@ -101,14 +101,14 @@ {{else}}
- {{if .LeftIdx}}{{.LeftIdx}}{{end}} + {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - {{if .RightIdx}}{{.RightIdx}}{{end}} + {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} -
{{.Content}}
+
{{$line.Content}}
- {{range .Sections}} - {{range $i, $line := .Lines}} + {{range $j, $section := $file.Sections}} + {{range $k, $line := $section.Lines}}
- {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} + {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} + {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} From e91b28eb9bd7b8e30a68e51e9c4d0bec4cf66624 Mon Sep 17 00:00:00 2001 From: Alexey Makhov Date: Wed, 4 Feb 2015 22:06:40 +0300 Subject: [PATCH 4/4] little fix --- templates/repo/diff.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index 13b78a38..ce31da6d 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -105,10 +105,10 @@ {{range $k, $line := $section.Lines}}
- {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} + {{if $line.LeftIdx}}{{$line.LeftIdx}}{{end}} - {{if $line.RightIdx}}{{$line.RightIdx}}{{end}} + {{if $line.RightIdx}}{{$line.RightIdx}}{{end}}