Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
50dfdf02
Commit
50dfdf02
authored
Jul 03, 2016
by
Luke "Jared" Bennett
Committed by
Paco Guzman
Jul 06, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix up tests
Added more exceptions Added handling inline view type
parent
914bb05d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
18 deletions
+27
-18
app/assets/javascripts/files_comment_button.js.coffee
app/assets/javascripts/files_comment_button.js.coffee
+17
-7
app/helpers/diff_helper.rb
app/helpers/diff_helper.rb
+1
-1
features/steps/shared/diff_note.rb
features/steps/shared/diff_note.rb
+8
-9
spec/helpers/diff_helper_spec.rb
spec/helpers/diff_helper_spec.rb
+1
-1
No files found.
app/assets/javascripts/files_comment_button.js.coffee
View file @
50dfdf02
...
@@ -8,11 +8,16 @@ class @FilesCommentButton
...
@@ -8,11 +8,16 @@ class @FilesCommentButton
@
LINE_HOLDER_CLASS
=
'.line_holder'
@
LINE_HOLDER_CLASS
=
'.line_holder'
@
LINE_NUMBER_CLASS
=
'diff-line-num'
@
LINE_NUMBER_CLASS
=
'diff-line-num'
@
LINE_CONTENT_CLASS
=
'line_content'
@
LINE_CONTENT_CLASS
=
'line_content'
@
UNFOLDABLE_LINE_CLASS
=
'js-unfold'
@
EMPTY_CELL_CLASS
=
'empty-cell'
@
OLD_LINE_CLASS
=
'old_line'
@
LINE_COLUMN_CLASSES
=
".
#{
@
LINE_NUMBER_CLASS
}
, .line_content"
@
LINE_COLUMN_CLASSES
=
".
#{
@
LINE_NUMBER_CLASS
}
, .line_content"
@
TEXT_FILE_SELECTOR
=
'.text-file'
@
TEXT_FILE_SELECTOR
=
'.text-file'
@
DEBOUNCE_TIMEOUT_DURATION
=
150
@
DEBOUNCE_TIMEOUT_DURATION
=
150
@
VIEW_TYPE
=
$
(
'input#view[type=hidden]'
).
val
()
$
(
document
)
$
(
document
)
.
on
'mouseover'
,
@
LINE_COLUMN_CLASSES
,
@
debounceRender
.
on
'mouseover'
,
@
LINE_COLUMN_CLASSES
,
@
debounceRender
.
on
'mouseleave'
,
@
LINE_COLUMN_CLASSES
,
@
destroy
.
on
'mouseleave'
,
@
LINE_COLUMN_CLASSES
,
@
destroy
...
@@ -38,13 +43,13 @@ class @FilesCommentButton
...
@@ -38,13 +43,13 @@ class @FilesCommentButton
id
:
id
:
noteable
:
textFileElement
.
attr
'data-noteable-id'
noteable
:
textFileElement
.
attr
'data-noteable-id'
commit
:
textFileElement
.
attr
'data-commit-id'
commit
:
textFileElement
.
attr
'data-commit-id'
discussion
:
lineContentElement
.
attr
(
'data-discussion-id'
)
||
lineHolderElement
.
attr
(
'data-discussion-id'
)
discussion
:
lineContentElement
.
attr
(
'data-discussion-id'
)
or
lineHolderElement
.
attr
(
'data-discussion-id'
)
type
:
type
:
noteable
:
textFileElement
.
attr
'data-noteable-type'
noteable
:
textFileElement
.
attr
'data-noteable-type'
note
:
textFileElement
.
attr
'data-note-type'
note
:
textFileElement
.
attr
'data-note-type'
line
:
lineContentElement
.
attr
'data-line-type'
line
:
lineContentElement
.
attr
'data-line-type'
code
:
code
:
line
:
lineContentElement
.
attr
(
'data-line-code'
)
||
lineHolderElement
.
attr
(
'id'
)
line
:
lineContentElement
.
attr
(
'data-line-code'
)
or
lineHolderElement
.
attr
(
'id'
)
return
return
destroy
:
(
e
)
=>
destroy
:
(
e
)
=>
...
@@ -70,14 +75,17 @@ class @FilesCommentButton
...
@@ -70,14 +75,17 @@ class @FilesCommentButton
$
(
hoveredElement
.
parent
())
$
(
hoveredElement
.
parent
())
getLineNum
:
(
hoveredElement
)
->
getLineNum
:
(
hoveredElement
)
->
return
hoveredElement
if
hoveredElement
.
hasClass
@
LINE_NUMBER_CLASS
if
@
VIEW_TYPE
is
'inline'
and
hoveredElement
.
hasClass
@
OLD_LINE_CLASS
$
(
hoveredElement
).
next
".
#{
@
LINE_NUMBER_CLASS
}
"
$
(
hoveredElement
).
prev
(
'.'
+
@
LINE_NUMBER_CLASS
)
else
if
hoveredElement
.
hasClass
@
LINE_NUMBER_CLASS
hoveredElement
else
$
(
hoveredElement
).
prev
".
#{
@
LINE_NUMBER_CLASS
}
"
getLineContent
:
(
hoveredElement
)
->
getLineContent
:
(
hoveredElement
)
->
return
hoveredElement
if
hoveredElement
.
hasClass
@
LINE_CONTENT_CLASS
return
hoveredElement
if
hoveredElement
.
hasClass
@
LINE_CONTENT_CLASS
$
(
hoveredElement
).
next
(
'.'
+
@
LINE_CONTENT_CLASS
)
$
(
hoveredElement
).
next
".
#{
@
LINE_CONTENT_CLASS
}
"
isMovingToSameType
:
(
e
)
->
isMovingToSameType
:
(
e
)
->
newLineNum
=
@
getLineNum
(
$
(
e
.
toElement
))
newLineNum
=
@
getLineNum
(
$
(
e
.
toElement
))
...
@@ -85,4 +93,6 @@ class @FilesCommentButton
...
@@ -85,4 +93,6 @@ class @FilesCommentButton
(
newLineNum
).
is
@
getLineNum
(
$
(
e
.
currentTarget
))
(
newLineNum
).
is
@
getLineNum
(
$
(
e
.
currentTarget
))
shouldRender
:
(
e
,
buttonParentElement
)
->
shouldRender
:
(
e
,
buttonParentElement
)
->
(
!
buttonParentElement
.
hasClass
(
'empty-cell'
)
and
$
(
@
COMMENT_BUTTON_CLASS
,
buttonParentElement
).
length
is
0
)
(
!
buttonParentElement
.
hasClass
(
@
EMPTY_CELL_CLASS
)
and
\
!
buttonParentElement
.
hasClass
(
@
UNFOLDABLE_LINE_CLASS
)
and
\
$
(
@
COMMENT_BUTTON_CLASS
,
buttonParentElement
).
length
is
0
)
app/helpers/diff_helper.rb
View file @
50dfdf02
...
@@ -39,7 +39,7 @@ module DiffHelper
...
@@ -39,7 +39,7 @@ module DiffHelper
end
end
def
unfold_bottom_class
(
bottom
)
def
unfold_bottom_class
(
bottom
)
bottom
?
'js-unfold-bottom'
:
''
bottom
?
'js-unfold
js-unfold
-bottom'
:
''
end
end
def
unfold_class
(
unfold
)
def
unfold_class
(
unfold
)
...
...
features/steps/shared/diff_note.rb
View file @
50dfdf02
...
@@ -25,8 +25,7 @@ module SharedDiffNote
...
@@ -25,8 +25,7 @@ module SharedDiffNote
page
.
within
(
"form[id$='
#{
sample_commit
.
line_code
}
-true']"
)
do
page
.
within
(
"form[id$='
#{
sample_commit
.
line_code
}
-true']"
)
do
fill_in
"note[note]"
,
with:
"Typo, please fix"
fill_in
"note[note]"
,
with:
"Typo, please fix"
find
(
".js-comment-button"
).
trigger
(
"click"
)
find
(
".js-comment-button"
).
click
sleep
0.05
end
end
end
end
end
end
...
@@ -35,7 +34,7 @@ module SharedDiffNote
...
@@ -35,7 +34,7 @@ module SharedDiffNote
click_parallel_diff_line
(
sample_commit
.
del_line_code
,
'old'
)
click_parallel_diff_line
(
sample_commit
.
del_line_code
,
'old'
)
page
.
within
(
"
#{
diff_file_selector
}
form[id$='
#{
sample_commit
.
del_line_code
}
-true']"
)
do
page
.
within
(
"
#{
diff_file_selector
}
form[id$='
#{
sample_commit
.
del_line_code
}
-true']"
)
do
fill_in
"note[note]"
,
with:
"Old comment"
fill_in
"note[note]"
,
with:
"Old comment"
find
(
".js-comment-button"
).
trigger
(
"click"
)
find
(
".js-comment-button"
).
click
end
end
end
end
...
@@ -43,7 +42,7 @@ module SharedDiffNote
...
@@ -43,7 +42,7 @@ module SharedDiffNote
click_parallel_diff_line
(
sample_commit
.
line_code
,
'new'
)
click_parallel_diff_line
(
sample_commit
.
line_code
,
'new'
)
page
.
within
(
"
#{
diff_file_selector
}
form[id$='
#{
sample_commit
.
line_code
}
-true']"
)
do
page
.
within
(
"
#{
diff_file_selector
}
form[id$='
#{
sample_commit
.
line_code
}
-true']"
)
do
fill_in
"note[note]"
,
with:
"New comment"
fill_in
"note[note]"
,
with:
"New comment"
find
(
".js-comment-button"
).
trigger
(
"click"
)
find
(
".js-comment-button"
).
click
end
end
end
end
...
@@ -211,7 +210,7 @@ module SharedDiffNote
...
@@ -211,7 +210,7 @@ module SharedDiffNote
end
end
step
'I click side-by-side diff button'
do
step
'I click side-by-side diff button'
do
find
(
'#parallel-diff-btn'
).
trigger
(
'click'
)
find
(
'#parallel-diff-btn'
).
click
end
end
step
'I see side-by-side diff button'
do
step
'I see side-by-side diff button'
do
...
@@ -223,12 +222,12 @@ module SharedDiffNote
...
@@ -223,12 +222,12 @@ module SharedDiffNote
end
end
def
click_diff_line
(
code
)
def
click_diff_line
(
code
)
find
(
".line_holder[id='
#{
code
}
'] td:nth-of-type(1)"
).
hover
find
(
".line_holder[id='
#{
code
}
'] td:nth-of-type(1)"
).
trigger
'mouseover'
find
(
".line_holder[id='
#{
code
}
'] button"
).
trigger
(
'click'
)
find
(
".line_holder[id='
#{
code
}
'] button"
).
trigger
'click'
end
end
def
click_parallel_diff_line
(
code
,
line_type
)
def
click_parallel_diff_line
(
code
,
line_type
)
find
(
".line_content.parallel.
#{
line_type
}
[data-line-code='
#{
code
}
']"
).
trigger
(
'mouseover'
)
find
(
".line_content.parallel.
#{
line_type
}
[data-line-code='
#{
code
}
']"
).
trigger
'mouseover'
find
(
".line_holder.parallel button[data-line-code='
#{
code
}
']"
).
trigger
(
'click'
)
find
(
".line_holder.parallel button[data-line-code='
#{
code
}
']"
).
trigger
'click'
end
end
end
end
spec/helpers/diff_helper_spec.rb
View file @
50dfdf02
...
@@ -59,7 +59,7 @@ describe DiffHelper do
...
@@ -59,7 +59,7 @@ describe DiffHelper do
end
end
it
'should return js class when bottom lines should be unfolded'
do
it
'should return js class when bottom lines should be unfolded'
do
expect
(
unfold_bottom_class
(
true
)).
to
eq
(
'js-unfold-bottom'
)
expect
(
unfold_bottom_class
(
true
)).
to
include
(
'js-unfold-bottom'
)
end
end
end
end
...
...
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