Show selected attachment in comment form
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
8fc9b5c0e2
commit
9c7d821cf7
1 changed files with 15 additions and 0 deletions
|
@ -37,6 +37,9 @@ class Notes
|
||||||
# attachment button
|
# attachment button
|
||||||
$(document).on "click", ".js-choose-note-attachment-button", @chooseNoteAttachment
|
$(document).on "click", ".js-choose-note-attachment-button", @chooseNoteAttachment
|
||||||
|
|
||||||
|
# update the file name when an attachment is selected
|
||||||
|
$(document).on "change", ".js-note-attachment-input", @updateFormAttachment
|
||||||
|
|
||||||
# reply to diff/discussion notes
|
# reply to diff/discussion notes
|
||||||
$(document).on "click", ".js-discussion-reply-button", @replyToDiscussionNote
|
$(document).on "click", ".js-discussion-reply-button", @replyToDiscussionNote
|
||||||
|
|
||||||
|
@ -429,4 +432,16 @@ class Notes
|
||||||
updateVotes: ->
|
updateVotes: ->
|
||||||
(new NotesVotes).updateVotes()
|
(new NotesVotes).updateVotes()
|
||||||
|
|
||||||
|
###
|
||||||
|
Called after an attachment file has been selected.
|
||||||
|
|
||||||
|
Updates the file name for the selected attachment.
|
||||||
|
###
|
||||||
|
updateFormAttachment: ->
|
||||||
|
form = $(this).closest("form")
|
||||||
|
|
||||||
|
# get only the basename
|
||||||
|
filename = $(this).val().replace(/^.*[\\\/]/, "")
|
||||||
|
form.find(".js-attachment-filename").text filename
|
||||||
|
|
||||||
@Notes = Notes
|
@Notes = Notes
|
||||||
|
|
Loading…
Reference in a new issue