BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ba18e0b2
Commit
ba18e0b2
authored
Apr 14, 2016
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '14176-diff-paste-data' into 'master'
Copying and pasting doesn't grab line numbers or +/- Fixes #14176 See merge request !3687
parents
95ce4d29
80d8f8b8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
31 deletions
+62
-31
diff.scss
app/assets/stylesheets/pages/diff.scss
+38
-0
notes.scss
app/assets/stylesheets/pages/notes.scss
+2
-8
diff_helper.rb
app/helpers/diff_helper.rb
+2
-1
diff.html.haml
app/views/projects/blob/diff.html.haml
+6
-6
_line.html.haml
app/views/projects/diffs/_line.html.haml
+10
-10
_diff.html.haml
app/views/projects/notes/discussions/_diff.html.haml
+3
-5
diff_note.rb
features/steps/shared/diff_note.rb
+1
-1
No files found.
app/assets/stylesheets/pages/diff.scss
View file @
ba18e0b2
...
...
@@ -67,6 +67,24 @@
line-height
:
$code_line_height
;
font-size
:
$code_font_size
;
&
.noteable_line
{
position
:
relative
;
&
.old
{
&
:before
{
content
:
'-'
;
position
:
absolute
;
}
}
&
.new
{
&
:before
{
content
:
'+'
;
position
:
absolute
;
}
}
}
span
{
white-space
:
pre
;
}
...
...
@@ -391,3 +409,23 @@
margin-bottom
:
0
;
}
}
.file-holder
{
.diff-line-num
:not
(
.js-unfold-bottom
)
{
a
{
&
:before
{
content
:
attr
(
data-linenumber
);
}
}
}
}
.discussion
{
.diff-content
{
.diff-line-num
{
&
:before
{
content
:
attr
(
data-linenumber
);
}
}
}
}
app/assets/stylesheets/pages/notes.scss
View file @
ba18e0b2
...
...
@@ -276,8 +276,7 @@ ul.notes {
.diff-file
tr
.line_holder
{
@mixin
show-add-diff-note
{
filter
:
alpha
(
opacity
=
100
);
opacity
:
1
.0
;
display
:
inline-block
;
}
.add-diff-note
{
...
...
@@ -291,13 +290,8 @@ ul.notes {
position
:
absolute
;
z-index
:
10
;
width
:
32px
;
transition
:
all
0
.2s
ease
;
// "hide" it by default
opacity
:
0
.0
;
filter
:
alpha
(
opacity
=
0
);
display
:
none
;
&
:hover
{
background
:
$gl-info
;
color
:
#fff
;
...
...
app/helpers/diff_helper.rb
View file @
ba18e0b2
...
...
@@ -40,10 +40,11 @@ module DiffHelper
(
unfold
)
?
'unfold js-unfold'
:
''
end
def
diff_line_content
(
line
)
def
diff_line_content
(
line
,
line_type
=
nil
)
if
line
.
blank?
" "
.
html_safe
else
line
[
0
]
=
' '
if
%w[new old]
.
include?
(
line_type
)
line
end
end
...
...
app/views/projects/blob/diff.html.haml
View file @
ba18e0b2
-
if
@lines
.
present?
-
if
@form
.
unfold?
&&
@form
.
since
!=
1
&&
!
@form
.
bottom?
%tr
.line_holder
{
id:
@form
.
since
}
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
line_old:
@form
.
since
,
line_new:
@form
.
since
,
bottom:
false
,
new_file:
false
}
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
line_old:
@form
.
since
,
line_new:
@form
.
since
,
bottom:
false
,
new_file:
false
}
-
@lines
.
each_with_index
do
|
line
,
index
|
-
line_new
=
index
+
@form
.
since
-
line_old
=
line_new
-
@form
.
offset
%tr
.line_holder
%td
.old_line.diff-line-num
{
data:
{
linenumber:
line_old
}
}
%td
.old_line.diff-line-num
{
data:
{
linenumber:
line_old
}
}
=
link_to
raw
(
line_old
),
"#"
%td
.new_line.diff-line-num
%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
%tr
.line_holder
{
id:
@form
.
to
}
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
line_old:
@form
.
to
,
line_new:
@form
.
to
,
bottom:
true
,
new_file:
false
}
=
render
"projects/diffs/match_line"
,
{
line:
@match_line
,
line_old:
@form
.
to
,
line_new:
@form
.
to
,
bottom:
true
,
new_file:
false
}
app/views/projects/diffs/_line.html.haml
View file @
ba18e0b2
-
type
=
line
.
type
%tr
.line_holder
{
id:
line_code
,
class:
type
}
%tr
.line_holder
{
id:
line_code
,
class:
type
}
-
case
type
-
when
'match'
=
render
"projects/diffs/match_line"
,
{
line:
line
.
text
,
line_old:
line
.
old_pos
,
line_new:
line
.
new_pos
,
bottom:
false
,
new_file:
diff_file
.
new_file
}
=
render
"projects/diffs/match_line"
,
{
line:
line
.
text
,
line_old:
line
.
old_pos
,
line_new:
line
.
new_pos
,
bottom:
false
,
new_file:
diff_file
.
new_file
}
-
when
'nonewline'
%td
.old_line.diff-line-num
%td
.new_line.diff-line-num
%td
.line_content.match
=
line
.
text
-
else
%td
.old_line.diff-line-num
{
class:
type
}
-
link_text
=
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)
%td
.old_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
-
link_text
=
type
==
"new"
?
" "
.
html_safe
:
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
}
}
-
link_text
=
raw
(
type
==
"old"
?
" "
:
line
.
new_pos
)
%td
.new_line.diff-line-num
{
class:
type
,
data:
{
linenumber:
line
.
new_pos
}
}
-
link_text
=
type
==
"old"
?
" "
.
html_safe
:
line
.
new_pos
-
if
defined?
(
plain
)
&&
plain
=
link_text
-
else
=
link_to
link_text
,
"#
#{
line_code
}
"
,
id:
line_code
%td
.line_content
{
class:
"noteable_line #{type} #{line_code}"
,
data:
{
line_code:
line_code
}}=
diff_line_content
(
line
.
text
)
=
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
,
type
)
app/views/projects/notes/discussions/_diff.html.haml
View file @
ba18e0b2
...
...
@@ -20,11 +20,9 @@
%td
.new_line.diff-line-num
=
"..."
%td
.line_content.match
=
line
.
text
-
else
%td
.old_line.diff-line-num
=
raw
(
type
==
"new"
?
" "
:
line
.
old_pos
)
%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
)
%td
.old_line.diff-line-num
{
data:
{
linenumber:
type
==
"new"
?
" "
.
html_safe
:
line
.
old_pos
}
}
%td
.new_line.diff-line-num
{
data:
{
linenumber:
type
==
"old"
?
" "
.
html_safe
:
line
.
new_pos
}
}
%td
.line_content
{
class:
[
'noteable_line'
,
type
,
line_code
],
line_code:
line_code
}=
diff_line_content
(
line
.
text
,
type
)
-
if
line_code
==
note
.
line_code
=
render
"projects/notes/diff_notes_with_reply"
,
notes:
discussion_notes
features/steps/shared/diff_note.rb
View file @
ba18e0b2
...
...
@@ -227,7 +227,7 @@ module SharedDiffNote
end
def
click_diff_line
(
code
)
find
(
"button[data-line-code='
#{
code
}
']"
).
click
find
(
"button[data-line-code='
#{
code
}
']"
).
trigger
(
'click'
)
end
def
click_parallel_diff_line
(
code
,
line_type
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment