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
Léo-Paul Géneau
gitlab-ce
Commits
7d654c0e
Commit
7d654c0e
authored
Aug 05, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added addtional 'renderable' validator to check 'data-note-type' attr exists
parent
9b079219
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
app/assets/javascripts/files_comment_button.js
app/assets/javascripts/files_comment_button.js
+10
-5
No files found.
app/assets/javascripts/files_comment_button.js
View file @
7d654c0e
...
...
@@ -39,12 +39,13 @@
FilesCommentButton
.
prototype
.
render
=
function
(
e
)
{
var
$currentTarget
,
buttonParentElement
,
lineContentElement
,
textFileElement
;
$currentTarget
=
$
(
e
.
currentTarget
);
buttonParentElement
=
this
.
getButtonParent
(
$currentTarget
);
if
(
!
this
.
shouldRender
(
e
,
buttonParentElement
))
{
return
;
}
textFileElement
=
this
.
getTextFileElement
(
$currentTarget
);
if
(
!
this
.
validateButtonParent
(
buttonParentElement
))
return
;
lineContentElement
=
this
.
getLineContent
(
$currentTarget
);
if
(
!
this
.
validateLineContent
(
lineContentElement
))
return
;
textFileElement
=
this
.
getTextFileElement
(
$currentTarget
);
buttonParentElement
.
append
(
this
.
buildButton
({
noteableType
:
textFileElement
.
attr
(
'
data-noteable-type
'
),
noteableID
:
textFileElement
.
attr
(
'
data-noteable-id
'
),
...
...
@@ -119,10 +120,14 @@
return
newButtonParent
.
is
(
this
.
getButtonParent
(
$
(
e
.
currentTarget
)));
};
FilesCommentButton
.
prototype
.
shouldRender
=
function
(
e
,
buttonParentElement
)
{
FilesCommentButton
.
prototype
.
validateButtonParent
=
function
(
buttonParentElement
)
{
return
!
buttonParentElement
.
hasClass
(
EMPTY_CELL_CLASS
)
&&
!
buttonParentElement
.
hasClass
(
UNFOLDABLE_LINE_CLASS
)
&&
$
(
COMMENT_BUTTON_CLASS
,
buttonParentElement
).
length
===
0
;
};
FilesCommentButton
.
prototype
.
validateLineContent
=
function
(
lineContentElement
)
{
return
lineContentElement
.
attr
(
'
data-note-type
'
)
&&
lineContentElement
.
attr
(
'
data-note-type
'
)
!==
''
;
};
return
FilesCommentButton
;
})();
...
...
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