diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index d0855f66911d127a1a39eeadd6620f586e0db203..ca7fa2094b6f5859813854655e7b97d52f94234d 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -67,6 +67,14 @@ line-height: $code_line_height; font-size: $code_font_size; + &.noteable_line.old:before { + content: '-'; + } + + &.noteable_line.new:before { + content: '+'; + } + span { white-space: pre; } @@ -391,3 +399,15 @@ margin-bottom: 0; } } + +.diff-line-num:not(.js-unfold-bottom) { + a { + &:before { + content: attr(data-linenumber); + } + -moz-user-select: none; + -webkit-user-select: none; + -ms-user-select: none; + user-select: none; + } +} diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index ff32e8344997b16120f1d314172f99f4c889775a..f1e213b34e8300b14beca1ea99632bd6e670eb61 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -44,6 +44,7 @@ module DiffHelper if line.blank? " ".html_safe else + line[0] = '' line end end diff --git a/app/views/projects/blob/diff.html.haml b/app/views/projects/blob/diff.html.haml index abcfca4cd11bf876978ca7e8023502c5534b39e5..ea6d4df72556a851960cf15c93931f02c9c96251 100644 --- a/app/views/projects/blob/diff.html.haml +++ b/app/views/projects/blob/diff.html.haml @@ -9,9 +9,9 @@ - line_old = line_new - @form.offset %tr.line_holder %td.old_line.diff-line-num{data: {linenumber: line_old}} - = link_to raw(line_old), "#" - %td.new_line.diff-line-num - = link_to raw(line_new) , "#" + / = link_to raw(line_old), "#" + %td.new_line.diff-line-num{data: {linenumber: line_old}} + / = 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/diffs/_line.html.haml b/app/views/projects/diffs/_line.html.haml index 9464c8dc9965b9285584dae3b915117237a0cc17..2dc6f5484375011670ed97936d56422f5fd7e8a9 100644 --- a/app/views/projects/diffs/_line.html.haml +++ b/app/views/projects/diffs/_line.html.haml @@ -9,12 +9,12 @@ %td.new_line.diff-line-num %td.line_content.match= line.text - else - %td.old_line.diff-line-num{class: type} + %td.old_line.diff-line-num{class: type, data: {linenumber: line.new_pos}} - link_text = raw(type == "new" ? " " : line.old_pos) - if defined?(plain) && plain = link_text - else - = link_to link_text, "##{line_code}", id: line_code + = link_to "", "##{line_code}", id: line_code, data: { linenumber: link_text } - if @comments_allowed && can?(current_user, :create_note, @project) = link_to_new_diff_note(line_code) %td.new_line.diff-line-num{class: type, data: {linenumber: line.new_pos}} @@ -22,5 +22,5 @@ - if defined?(plain) && plain = link_text - else - = link_to link_text, "##{line_code}", id: line_code + = link_to "", "##{line_code}", id: line_code, data: { linenumber: link_text } %td.line_content{class: "noteable_line #{type} #{line_code}", data: { line_code: line_code }}= diff_line_content(line.text)