Commit 5ab95ba6 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

review changes

parent c6abeffe
class @FilesCommentButton class @FilesCommentButton
constructor: (@filesContainerElement) -> constructor: (@filesContainerElement) ->
return if not @filesContainerElement return unless @filesContainerElement
return if not @filesContainerElement.data 'can-create-note' return if _.isUndefined @filesContainerElement.data 'can-create-note'
@COMMENT_BUTTON_CLASS = '.add-diff-note' @COMMENT_BUTTON_CLASS = '.add-diff-note'
@COMMENT_BUTTON_TEMPLATE = _.template("<button name='button' type='submit' class='btn <%- COMMENT_BUTTON_CLASS %> js-add-diff-note-button' title='Add a comment to this line'><i class='fa fa-comment-o'></i></button>") @COMMENT_BUTTON_TEMPLATE = _.template '<button name="button" type="submit" class="btn <%- COMMENT_BUTTON_CLASS %> js-add-diff-note-button" title="Add a comment to this line"><i class="fa fa-comment-o"></i></button>'
@LINE_HOLDER_CLASS = '.line_holder' @LINE_HOLDER_CLASS = '.line_holder'
@LINE_NUMBER_CLASS = 'diff-line-num' @LINE_NUMBER_CLASS = 'diff-line-num'
...@@ -37,7 +37,7 @@ class @FilesCommentButton ...@@ -37,7 +37,7 @@ class @FilesCommentButton
lineContentElement = @getLineContent(currentTarget) lineContentElement = @getLineContent(currentTarget)
buttonParentElement = @getButtonParent(currentTarget) buttonParentElement = @getButtonParent(currentTarget)
return if not @shouldRender e, buttonParentElement return unless @shouldRender e, buttonParentElement
buttonParentElement.append @buildButton buttonParentElement.append @buildButton
id: id:
...@@ -58,7 +58,9 @@ class @FilesCommentButton ...@@ -58,7 +58,9 @@ class @FilesCommentButton
return return
buildButton: (buttonAttributes) -> buildButton: (buttonAttributes) ->
$(@COMMENT_BUTTON_TEMPLATE COMMENT_BUTTON_CLASS: @COMMENT_BUTTON_CLASS.substr 1).attr initializedButtonTemplate = @COMMENT_BUTTON_TEMPLATE
COMMENT_BUTTON_CLASS: @COMMENT_BUTTON_CLASS.substr 1
$(initializedButtonTemplate).attr
'data-noteable-id': buttonAttributes.id.noteable 'data-noteable-id': buttonAttributes.id.noteable
'data-commit-id': buttonAttributes.id.commit 'data-commit-id': buttonAttributes.id.commit
'data-discussion-id': buttonAttributes.id.discussion 'data-discussion-id': buttonAttributes.id.discussion
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
- if diff_files.overflow? - if diff_files.overflow?
= render 'projects/diffs/warning', diff_files: diff_files = render 'projects/diffs/warning', diff_files: diff_files
.files{data: {can_create_note: (!@diff_notes_disabled && can?(current_user, :create_note, @project)).to_s}} .files{data: {can_create_note: (!@diff_notes_disabled && can?(current_user, :create_note, @project))}}
- diff_files.each_with_index do |diff_file, index| - diff_files.each_with_index do |diff_file, index|
- diff_commit = commit_for_diff(diff_file) - diff_commit = commit_for_diff(diff_file)
- blob = project.repository.blob_for_diff(diff_commit, diff_file) - blob = project.repository.blob_for_diff(diff_commit, diff_file)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment