diff --git a/app/assets/stylesheets/framework/common.scss b/app/assets/stylesheets/framework/common.scss index 585a9d8391336afeb14b3d0e7f31444b88b2effe..9bc814cfd2d6c20f8ab3125a88d9ebb4cb18a92e 100644 --- a/app/assets/stylesheets/framework/common.scss +++ b/app/assets/stylesheets/framework/common.scss @@ -120,14 +120,6 @@ span.update-author { display: inline; } -.line_holder { - &:hover { - td { - background: #FFFFCF !important; - } - } -} - p.time { color: #999; font-size: 90%; diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index 6ee104ee31a575731680d569c7fcd38d22d6a5be..a4791cf6b34ab370c068e73ee1f992c1f5b2515f 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -92,15 +92,6 @@ &:last-child { border-right: none; } - background: #fff; - } - .lines { - pre { - padding: 0; - margin: 0; - background: none; - border: none; - } } img.avatar { border: 0 none; @@ -116,18 +107,18 @@ color: #888; } } - td.blame-numbers { - pre { - color: #AAA; - white-space: pre; - } - background: #f1f1f1; + td.line-numbers { + float: none; border-left: 1px solid #DDD; } td.lines { + padding: 0; code { font-family: $monospace_font; } + pre { + margin: 0; + } } } diff --git a/app/assets/stylesheets/highlight/dark.scss b/app/assets/stylesheets/highlight/dark.scss index 8201735beb5573f01783792dae77cfe80158881f..c7f7a5aaf070f1e7a64ac8af6953b7f193e03412 100644 --- a/app/assets/stylesheets/highlight/dark.scss +++ b/app/assets/stylesheets/highlight/dark.scss @@ -1,20 +1,40 @@ /* https://github.com/MozMorris/tomorrow-pygments */ .code.dark { + // Line numbers + .line-numbers, .diff-line-num { + background-color: #1d1f21; + } - background-color: #1d1f21 !important; - color: #c5c8c6 !important; - - pre.highlight, - .line-numbers, - .line-numbers a { - background-color: #1d1f21 !important; - color: #c5c8c6 !important; + .diff-line-num, .diff-line-num a { + color: rgba(255, 255, 255, 0.3); } + // Code itself pre.code { border-left: 1px solid #666; } + &, pre.code, .line_holder .line_content { + background-color: #1d1f21; + color: #c5c8c6; + } + + // Diff line + .line_holder { + .diff-line-num.new, .line_content.new { + @include diff_background(rgba(51, 255, 51, 0.1), rgba(51, 255, 51, 0.3), #808080); + } + + .diff-line-num.old, .line_content.old { + @include diff_background(rgba(255, 51, 51, 0.2), rgba(255, 51, 51, 0.3), #808080); + } + + .line_content.match { + color: rgba(255, 255, 255, 0.3); + background: rgba(255, 255, 255, 0.1); + } + } + // highlight line via anchor pre .hll { background-color: #557 !important; @@ -90,22 +110,4 @@ .vg { color: #cc6666 } /* Name.Variable.Global */ .vi { color: #cc6666 } /* Name.Variable.Instance */ .il { color: #de935f } /* Literal.Number.Integer.Long */ - - .line_holder { - &.parallel .new.new_line, - &.parallel .new.line_content, - &.new .old_line, - &.new .new_line, - &.new .line_content { - @include diff_background(255, 255, 255, #808080); - } - - &.parallel .old.old_line, - &.parallel .old.line_content, - &.old .old_line, - &.old .new_line, - &.old .line_content { - @include diff_background(255, 51, 51, #808080); - } - } } diff --git a/app/assets/stylesheets/highlight/monokai.scss b/app/assets/stylesheets/highlight/monokai.scss index cc03ed6ae454b43d6eb75e25ae28ff2e2a00818c..516d8aef96032c759b0d16c729b8bf60d8bad175 100644 --- a/app/assets/stylesheets/highlight/monokai.scss +++ b/app/assets/stylesheets/highlight/monokai.scss @@ -1,20 +1,40 @@ /* https://github.com/richleland/pygments-css/blob/master/monokai.css */ .code.monokai { + // Line numbers + .line-numbers, .diff-line-num { + background-color: #272822; + } - background-color: #272822 !important; - color: #f8f8f2 !important; - - pre.highlight, - .line-numbers, - .line-numbers a { - background-color :#272822 !important; - color: #f8f8f2 !important; + .diff-line-num, .diff-line-num a { + color: rgba(255, 255, 255, 0.3); } + // Code itself pre.code { border-left: 1px solid #555; } + &, pre.code, .line_holder .line_content { + background-color: #272822; + color: #f8f8f2; + } + + // Diff line + .line_holder { + .diff-line-num.new, .line_content.new { + @include diff_background(rgba(166, 226, 46, 0.2), rgba(166, 226, 46, 0.3), #808080); + } + + .diff-line-num.old, .line_content.old { + @include diff_background(rgba(254, 147, 140, 0.2), rgba(254, 147, 140, 0.3), #808080); + } + + .line_content.match { + color: rgba(255, 255, 255, 0.3); + background: rgba(255, 255, 255, 0.1); + } + } + // highlight line via anchor pre .hll { background-color: #49483e !important; @@ -90,22 +110,4 @@ .gu { color: #75715e; } /* Generic.Subheading & Diff Unified/Comment? */ .gd { color: #f92672; } /* Generic.Deleted & Diff Deleted */ .gi { color: #a6e22e; } /* Generic.Inserted & Diff Inserted */ - - .line_holder { - &.parallel .new.new_line, - &.parallel .new.line_content, - &.new .old_line, - &.new .new_line, - &.new .line_content { - @include diff_background(156, 175, 183, #808080); - } - - &.parallel .old.old_line, - &.parallel .old.line_content, - &.old .old_line, - &.old .new_line, - &.old .line_content { - @include diff_background(254, 147, 140, #808080); - } - } } diff --git a/app/assets/stylesheets/highlight/solarized_dark.scss b/app/assets/stylesheets/highlight/solarized_dark.scss index fdfac6cd2494f6bc1739c8203ab6a637e18f203b..ae7ecc65c39c630bff622a44e3ba8829f847910b 100644 --- a/app/assets/stylesheets/highlight/solarized_dark.scss +++ b/app/assets/stylesheets/highlight/solarized_dark.scss @@ -1,20 +1,40 @@ /* https://gist.github.com/qguv/7936275 */ .code.solarized-dark { + // Line numbers + .line-numbers, .diff-line-num { + background-color: #002b36; + } - background-color: #002b36 !important; - color: #93a1a1 !important; - - pre.highlight, - .line-numbers, - .line-numbers a { - background-color: #002b36 !important; - color: #93a1a1 !important; + .diff-line-num, .diff-line-num a { + color: rgba(255, 255, 255, 0.3); } + // Code itself pre.code { border-left: 1px solid #113b46; } + &, pre.code, .line_holder .line_content { + background-color: #002b36; + color: #93a1a1; + } + + // Diff line + .line_holder { + .diff-line-num.new, .line_content.new { + @include diff_background(rgba(133, 153, 0, 0.2), rgba(133, 153, 0, 0.3), #808080); + } + + .diff-line-num.old, .line_content.old { + @include diff_background(rgba(220, 50, 47, 0.2), rgba(220, 50, 47, 0.3), #808080); + } + + .line_content.match { + color: rgba(255, 255, 255, 0.3); + background: rgba(255, 255, 255, 0.1); + } + } + // highlight line via anchor pre .hll { background-color: #174652 !important; @@ -111,22 +131,4 @@ .vg { color: #268bd2 } /* Name.Variable.Global */ .vi { color: #268bd2 } /* Name.Variable.Instance */ .il { color: #2aa198 } /* Literal.Number.Integer.Long */ - - .line_holder { - &.parallel .new.new_line, - &.parallel .new.line_content, - &.new .old_line, - &.new .new_line, - &.new .line_content { - @include diff_background(255, 255, 255, #808080); - } - - &.parallel .old.old_line, - &.parallel .old.line_content, - &.old .old_line, - &.old .new_line, - &.old .line_content { - @include diff_background(255, 51, 51, #808080); - } - } } diff --git a/app/assets/stylesheets/highlight/solarized_light.scss b/app/assets/stylesheets/highlight/solarized_light.scss index f9788951aa840ad9d59b0fab6fa4ff7023bb9aa1..1c1385721458beb4f1081831cd2108e8a7d1a800 100644 --- a/app/assets/stylesheets/highlight/solarized_light.scss +++ b/app/assets/stylesheets/highlight/solarized_light.scss @@ -1,20 +1,40 @@ /* https://gist.github.com/qguv/7936275 */ .code.solarized-light { + // Line numbers + .line-numbers, .diff-line-num { + background-color: #fdf6e3; + } - background-color: #fdf6e3 !important; - color: #586e75 !important; - - pre.highlight, - .line-numbers, - .line-numbers a { - background-color: #fdf6e3 !important; - color: #586e75 !important; + .diff-line-num, .diff-line-num a { + color: rgba(0, 0, 0, 0.3); } + // Code itself pre.code { border-left: 1px solid #c5d0d4; } + &, pre.code, .line_holder .line_content { + background-color: #fdf6e3; + color: #586e75; + } + + // Diff line + .line_holder { + .diff-line-num.new, .line_content.new { + @include diff_background(rgba(133, 153, 0, 0.2), rgba(133, 153, 0, 0.3), #FAF3DD); + } + + .diff-line-num.old, .line_content.old { + @include diff_background(rgba(220, 50, 47, 0.2), rgba(220, 50, 47, 0.3), #FAF3DD); + } + + .line_content.match { + color: rgba(0, 0, 0, 0.3); + background: rgba(255, 255, 255, 0.4); + } + } + // highlight line via anchor pre .hll { background-color: #ddd8c5 !important; @@ -111,23 +131,4 @@ .vg { color: #268bd2 } /* Name.Variable.Global */ .vi { color: #268bd2 } /* Name.Variable.Instance */ .il { color: #2aa198 } /* Literal.Number.Integer.Long */ - - - .line_holder { - &.parallel .new.new_line, - &.parallel .new.line_content, - &.new .old_line, - &.new .new_line, - &.new .line_content { - @include diff_background(92, 164, 169, #FAF3DD); - } - - &.parallel .old.old_line, - &.parallel .old.line_content, - &.old .old_line, - &.old .new_line, - &.old .line_content { - @include diff_background(237, 106, 90, #FAF3DD); - } - } } diff --git a/app/assets/stylesheets/highlight/white.scss b/app/assets/stylesheets/highlight/white.scss index e2626da78712858274a8fb233595f770ce765254..8a932e6540e727a16ab9581f037652c68c9ba055 100644 --- a/app/assets/stylesheets/highlight/white.scss +++ b/app/assets/stylesheets/highlight/white.scss @@ -1,20 +1,60 @@ /* https://github.com/aahan/pygments-github-style */ .code.white { + // Line numbers + .line-numbers, .diff-line-num { + background-color: $background-color; + } - background-color: #f8fafc !important; - color: #5b6169 !important; - - pre.highlight, - .line-numbers, - .line-numbers a { - background-color: $background-color !important; - color: $gl-gray !important; + .diff-line-num, .diff-line-num a { + color: rgba(0, 0, 0, 0.3); } + // Code itself pre.code { border-left: 1px solid $border-color; - background-color: #fff !important; - color: #333 !important; + } + + &, pre.code, .line_holder .line_content { + background-color: #fff; + color: #333; + } + + // Diff line + .line_holder { + .diff-line-num { + &.old { + background: #ffdddd; + border-color: #f1c0c0; + } + + &.new { + background: #dbffdb; + border-color: #c1e9c1; + } + } + + .line_content { + &.old { + background: #ffecec; + + span.idiff { + background-color: #f8cbcb; + } + } + + &.new { + background: #eaffea; + + span.idiff { + background-color: #a6f3a6; + } + } + + &.match { + color: rgba(0, 0, 0, 0.3); + background: #fafafa; + } + } } // highlight line via anchor diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index 0b79aa172a47ea31e5d63146de8eb32f0abcc470..5215df04a6e2094c9bfcd3a0c9c1f3a31688d4df 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -32,16 +32,6 @@ background: #FFF; color: #333; - .old { - span.idiff { - background-color: #f8cbcb; - } - } - .new { - span.idiff { - background-color: #a6f3a6; - } - } .unfold { cursor: pointer; } @@ -76,7 +66,7 @@ } tr.line_holder.parallel { - .old_line, .new_line, .diff_line { + .old_line, .new_line { min-width: 50px; } @@ -85,7 +75,7 @@ } } - .old_line, .new_line, .diff_line { + .old_line, .new_line { margin: 0px; padding: 0px; border: none; @@ -107,43 +97,12 @@ text-decoration: underline; } } - &.new { - background: #CFD; - } - &.old { - background: #FDD; - } - } - .diff_line { - padding: 0; - } - .line_holder { - &.old .old_line, - &.old .new_line { - background: #ffdddd; - border-color: #f1c0c0; - } - &.new .old_line, - &.new .new_line { - background: #dbffdb; - border-color: #c1e9c1; - } } .line_content { display: block; margin: 0px; padding: 0px 0.5em; border: none; - &.new { - background: #eaffea; - } - &.old { - background: #ffecec; - } - &.matched { - color: $border-color; - background: #fafafa; - } &.parallel { display: table-cell; } @@ -394,17 +353,14 @@ } } -@mixin diff_background($r, $g, $b, $custom-border) { - /* Fallback for web browsers that doesn't support RGBa */ - background: rgb($r, $g, $b); - /* RGBa with 0.3 opacity */ - background: rgba($r, $g, $b, 0.3); +@mixin diff_background($background, $idiff, $border) { + background: $background; - &.new_line, &.old_line { - border-right-color: $custom-border !important; + &.line_content span.idiff { + background: $idiff; } - &.line_content span.idiff { - background: rgb($r, $g, $b); + &.diff-line-num { + border-color: $border; } } diff --git a/app/assets/stylesheets/pages/note_form.scss b/app/assets/stylesheets/pages/note_form.scss index 2c9a42f9892eee20c5b23190b7886d354c301837..32ba1676333c217146028b70d6d7f46952cea275 100644 --- a/app/assets/stylesheets/pages/note_form.scss +++ b/app/assets/stylesheets/pages/note_form.scss @@ -10,18 +10,6 @@ margin: 10px $gl-padding; } .diff-file .diff-content { - tr.line_holder:hover { - &> td.line_content { - background: $hover !important; - border-color: darken($hover, 10%) !important; - } - &> td.new_line, - &> td.old_line { - background: darken($hover, 4%) !important; - border-color: darken($hover, 10%) !important; - } - } - tr.line_holder:hover > td .line_note_link { opacity: 1.0; filter: alpha(opacity=100); diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 72b0ed29a698b1d2e95b79c8c654f61784a2165f..f6343e6bb1ef97179f906ffe83e679492f440ea6 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -242,11 +242,8 @@ ul.notes { // "show" the icon also if we just hover somewhere over the line &:hover > td { - background: $hover !important; - .add-diff-note { @include show-add-diff-note; } } } - diff --git a/app/models/members/project_member.rb b/app/models/members/project_member.rb index 1b0c76917aa377d47abb47c2be4716fe5c8a9976..560d1690e1432de9698378c9515eddccc60d81a9 100644 --- a/app/models/members/project_member.rb +++ b/app/models/members/project_member.rb @@ -84,7 +84,7 @@ class ProjectMember < Member def truncate_teams(project_ids) ProjectMember.transaction do members = ProjectMember.where(source_id: project_ids) - + members.each do |member| member.destroy end @@ -133,13 +133,13 @@ class ProjectMember < Member event_service.join_project(self.project, self.user) notification_service.new_project_member(self) end - + super end def post_update_hook if access_level_changed? - notification_service.update_project_member(self) + notification_service.update_project_member(self) end super diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index d5d04954490cae82bf8e6dbd49f0ee32ff5cd798..53dcac78a9f9e1c7da6177aee9bb7b0ba1dbf1ac 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -12,7 +12,7 @@ %small= number_to_human_size @blob.size .file-actions = render "projects/blob/actions" - .file-content.blame.highlight + .file-content.blame.code.js-syntax-highlight %table - current_line = 1 - blame_highlighter = highlighter(@blob.name, @blob.data, nowrap: true) @@ -31,15 +31,14 @@ = commit_author_link(commit, avatar: false) authored #{time_ago_with_tooltip(commit.committed_date, skip_js: true)} - %td.lines.blame-numbers - %pre - - line_count = blame_group[:lines].count - - (current_line...(current_line + line_count)).each do |i| - = i - \ - - current_line += line_count + %td.line-numbers + - line_count = blame_group[:lines].count + - (current_line...(current_line + line_count)).each do |i| + %a.diff-line-num= i + \ + - current_line += line_count %td.lines - %pre{class: 'code highlight white'} + %pre{class: 'code highlight'} %code - blame_group[:lines].each do |line| :preserve diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml index 2e913802be199c3612507158fab133d12c36f8e3..abcfca4cd11bf876978ca7e8023502c5534b39e5 100644 --- a/app/views/projects/blob/diff.html.haml +++ b/app/views/projects/blob/diff.html.haml @@ -10,7 +10,8 @@ %tr.line_holder %td.old_line.diff-line-num{data: {linenumber: line_old}} = link_to raw(line_old), "#" - %td.new_line= link_to raw(line_new) , "#" + %td.new_line.diff-line-num + = link_to raw(line_new) , "#" %td.line_content.noteable_line==#{' ' * @form.indent}#{line} - if @form.unfold? && @form.bottom? && @form.to < @blob.loc diff --git a/app/views/projects/blob/preview.html.haml b/app/views/projects/blob/preview.html.haml index fed483d67881635a72510e4bc82c5175a6ee06dd..c5a269f334c6d62fdbafc3f4a735d41156c4d49a 100644 --- a/app/views/projects/blob/preview.html.haml +++ b/app/views/projects/blob/preview.html.haml @@ -14,12 +14,12 @@ - @diff_lines.each do |line| %tr.line_holder{ class: "#{line.type}" } - if line.type == "match" - %td.old_line= "..." - %td.new_line= "..." - %td.line_content.matched= line.text + %td.old_line.diff-line-num= "..." + %td.new_line.diff-line-num= "..." + %td.line_content.match= line.text - else - %td.old_line - %td.new_line + %td.old_line.diff-line-num + %td.new_line.diff-line-num %td.line_content{class: "#{line.type}"}= diff_line_content(line.text) - else .nothing-here-block No changes. diff --git a/app/views/projects/diffs/_match_line.html.haml b/app/views/projects/diffs/_match_line.html.haml index d1f897b99f78680591956eb00f967bf21ef9a90b..d6dddd97879ce85f9f53667eaa91e7055ff1a0f4 100644 --- a/app/views/projects/diffs/_match_line.html.haml +++ b/app/views/projects/diffs/_match_line.html.haml @@ -4,4 +4,4 @@ %td.new_line.diff-line-num{data: {linenumber: line_new}, class: [unfold_bottom_class(bottom), unfold_class(!new_file)]} \... -%td.line_content.matched= line +%td.line_content.match= line diff --git a/app/views/projects/diffs/_match_line_parallel.html.haml b/app/views/projects/diffs/_match_line_parallel.html.haml index 815df16aa4ab92ed646ae99df498d78fed75a5b0..0cd888876e02bc4ea7cf0f76fb5006353072af06 100644 --- a/app/views/projects/diffs/_match_line_parallel.html.haml +++ b/app/views/projects/diffs/_match_line_parallel.html.haml @@ -1,4 +1,4 @@ -%td.old_line - %td.line_content.parallel.matched= line -%td.new_line - %td.line_content.parallel.matched= line +%td.old_line.diff-line-num +%td.line_content.parallel.match= line +%td.new_line.diff-line-num +%td.line_content.parallel.match= line diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml index a15d147ab051109319649aea5c726d8d369747a7..d7c490687452048974bb951e4f9232676644a70e 100644 --- a/app/views/projects/diffs/_parallel_view.html.haml +++ b/app/views/projects/diffs/_parallel_view.html.haml @@ -9,16 +9,16 @@ = render "projects/diffs/match_line_parallel", { line: left[:text], line_old: left[:number], line_new: right[:number] } - elsif left[:type] == 'nonewline' - %td.old_line - %td.line_content.parallel.matched= left[:text] - %td.new_line - %td.line_content.parallel.matched= left[:text] + %td.old_line.diff-line-num + %td.line_content.parallel.match= left[:text] + %td.new_line.diff-line-num + %td.line_content.parallel.match= left[:text] - else - %td.old_line{id: left[:line_code], class: "#{left[:type]}"} + %td.old_line.diff-line-num{id: left[:line_code], class: "#{left[:type]}"} = link_to raw(left[:number]), "##{left[:line_code]}", id: left[:line_code] - if @comments_allowed && can?(current_user, :create_note, @project) = link_to_new_diff_note(left[:line_code], 'old') - %td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text]) + %td.line_content{class: "parallel noteable_line #{left[:type]} #{left[:line_code]}", data: { line_code: left[:line_code] }}= diff_line_content(left[:text]) - if right[:type] == 'new' - new_line_class = 'new' @@ -27,11 +27,11 @@ - new_line_class = nil - new_line_code = left[:line_code] - %td.new_line{id: new_line_code, class: "#{new_line_class}", data: { linenumber: right[:number] }} + %td.new_line.diff-line-num{id: new_line_code, class: "#{new_line_class}", data: { linenumber: right[:number] }} = link_to raw(right[:number]), "##{new_line_code}", id: new_line_code - if @comments_allowed && can?(current_user, :create_note, @project) = link_to_new_diff_note(right[:line_code], 'new') - %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", data: { line_code: new_line_code }}= diff_line_content(right[:text]) + %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", data: { line_code: new_line_code }}= diff_line_content(right[:text]) - if @reply_allowed - comments_left, comments_right = organize_comments(left[:type], right[:type], left[:line_code], right[:line_code]) diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index f4fc6caba0f31ed557b6f4dffa0ef427eeeeb748..d9f2dce13890b48d42c5b0d5d5afbd445f4b1c93 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -18,13 +18,13 @@ - elsif type == 'nonewline' %td.old_line.diff-line-num %td.new_line.diff-line-num - %td.line_content.matched= line.text + %td.line_content.match= line.text - else - %td.old_line + %td.old_line.diff-line-num{class: type} = link_to raw(type == "new" ? " " : line_old), "##{line_code}", id: line_code - if @comments_allowed && can?(current_user, :create_note, @project) = link_to_new_diff_note(line_code) - %td.new_line{data: {linenumber: line.new_pos}} + %td.new_line.diff-line-num{class: type, data: {linenumber: line.new_pos}} = link_to raw(type == "old" ? " " : line.new_pos), "##{line_code}", id: line_code %td.line_content{class: "noteable_line #{type} #{line_code}", data: { line_code: line_code }}= diff_line_content(line.text) diff --git a/app/views/projects/notes/discussions/_diff.html.haml b/app/views/projects/notes/discussions/_diff.html.haml index 46962b184cee5331bf80c7f527ba7d565b162591..92bbaf0961a18b35f0c6f8750f987dc58e98e63d 100644 --- a/app/views/projects/notes/discussions/_diff.html.haml +++ b/app/views/projects/notes/discussions/_diff.html.haml @@ -16,13 +16,13 @@ - line_code = generate_line_code(note.file_path, line) %tr.line_holder{ id: line_code, class: "#{type}" } - if type == "match" - %td.old_line= "..." - %td.new_line= "..." - %td.line_content.matched= line.text + %td.old_line.diff-line-num= "..." + %td.new_line.diff-line-num= "..." + %td.line_content.match= line.text - else - %td.old_line + %td.old_line.diff-line-num = raw(type == "new" ? " " : line.old_pos) - %td.new_line + %td.new_line.diff-line-num = raw(type == "old" ? " " : line.new_pos) %td.line_content{class: "noteable_line #{type} #{line_code}", line_code: line_code}= diff_line_content(line.text) diff --git a/app/views/search/results/_snippet_blob.html.haml b/app/views/search/results/_snippet_blob.html.haml index 9a4f9fb9485433c382bfdce23f6ea87be3572f78..dcd6119971736c27d651482c2f218b999c2af8c2 100644 --- a/app/views/search/results/_snippet_blob.html.haml +++ b/app/views/search/results/_snippet_blob.html.haml @@ -22,29 +22,27 @@ .file-content.code .nothing-here-block Empty file - else - .file-content.code - %div.highlighted-data{ class: user_color_scheme } - .line-numbers + .file-content.code.js-syntax-highlight + .line-numbers + - snippet_blob[:snippet_chunks].each do |snippet| + - unless snippet[:data].empty? + - snippet[:data].lines.to_a.size.times do |index| + - offset = defined?(snippet[:start_line]) ? snippet[:start_line] : 1 + - i = index + offset + = link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}", class: "diff-line-num" do + %i.fa.fa-link + = i + - unless snippet == snippet_blob[:snippet_chunks].last + %a.diff-line-num + = "." + %pre.code + %code - snippet_blob[:snippet_chunks].each do |snippet| - unless snippet[:data].empty? - - snippet[:data].lines.to_a.size.times do |index| - - offset = defined?(snippet[:start_line]) ? snippet[:start_line] : 1 - - i = index + offset - = link_to snippet_path+"#L#{i}", id: "L#{i}", rel: "#L#{i}" do - %i.fa.fa-link - = i + = snippet[:data] - unless snippet == snippet_blob[:snippet_chunks].last %a - = "." - .highlight.term - %pre - %code - - snippet_blob[:snippet_chunks].each do |snippet| - - unless snippet[:data].empty? - = snippet[:data] - - unless snippet == snippet_blob[:snippet_chunks].last - %a - = "..." - - else - .file-content.code - .nothing-here-block Empty file + = "..." + - else + .file-content.code + .nothing-here-block Empty file diff --git a/app/views/shared/_file_highlight.html.haml b/app/views/shared/_file_highlight.html.haml index 1bef1de433afc161771a14714ed07fd6f3dcef5d..ee242c94db82baac988bfaddd04ccda78698882d 100644 --- a/app/views/shared/_file_highlight.html.haml +++ b/app/views/shared/_file_highlight.html.haml @@ -1,11 +1,11 @@ -.file-content.code.js-syntax-highlight{ class: user_color_scheme } +.file-content.code.js-syntax-highlight .line-numbers - if blob.data.present? - blob.data.lines.each_index do |index| - offset = defined?(first_line_number) ? first_line_number : 1 - i = index + offset -# We're not using `link_to` because it is too slow once we get to thousands of lines. - %a{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i} + %a.diff-line-num{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i} %i.fa.fa-link = i .blob-content{data: {blob_id: blob.id}}