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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ec37d955
Commit
ec37d955
authored
Jul 08, 2016
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored .prev and .next methods
parent
d1d74814
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
app/assets/javascripts/files_comment_button.js.coffee
app/assets/javascripts/files_comment_button.js.coffee
+7
-3
No files found.
app/assets/javascripts/files_comment_button.js.coffee
View file @
ec37d955
...
...
@@ -7,6 +7,7 @@ class @FilesCommentButton
UNFOLDABLE_LINE_CLASS
=
'js-unfold'
EMPTY_CELL_CLASS
=
'empty-cell'
OLD_LINE_CLASS
=
'old_line'
NEW_CLASS
=
'new'
LINE_COLUMN_CLASSES
=
".
#{
LINE_NUMBER_CLASS
}
, .line_content"
TEXT_FILE_SELECTOR
=
'.text-file'
DEBOUNCE_TIMEOUT_DURATION
=
100
...
...
@@ -63,17 +64,20 @@ class @FilesCommentButton
getLineContent
:
(
hoveredElement
)
->
return
hoveredElement
if
hoveredElement
.
hasClass
LINE_CONTENT_CLASS
$
(
hoveredElement
).
next
".
#{
LINE_CONTENT_CLASS
}
"
$
(
".
#{
LINE_CONTENT_CLASS
+
@
diffTypeClass
hoveredElement
}
"
,
hoveredElement
.
parent
())
getButtonParent
:
(
hoveredElement
)
->
if
@
VIEW_TYPE
is
'inline'
return
hoveredElement
if
hoveredElement
.
hasClass
OLD_LINE_CLASS
hoveredElement
.
parent
().
find
".
#{
OLD_LINE_CLASS
}
"
$
(
".
#{
OLD_LINE_CLASS
}
"
,
hoveredElement
.
parent
())
else
return
hoveredElement
if
hoveredElement
.
hasClass
LINE_NUMBER_CLASS
$
(
hoveredElement
).
prev
".
#{
LINE_NUMBER_CLASS
}
"
$
(
".
#{
LINE_NUMBER_CLASS
+
@
diffTypeClass
hoveredElement
}
"
,
hoveredElement
.
parent
())
diffTypeClass
:
(
hoveredElement
)
->
if
hoveredElement
.
hasClass
(
NEW_CLASS
)
then
'.new'
else
'.old'
isMovingToSameType
:
(
e
)
->
newButtonParent
=
@
getButtonParent
$
(
e
.
toElement
)
...
...
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