From ab401a6132411294cee03cf4e0902ec75c2c42dc Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@gitlab.com>
Date: Mon, 16 Feb 2015 22:08:44 +0100
Subject: [PATCH] Remove note attachment file selector.

---
 app/assets/javascripts/notes.js.coffee        | 13 -------------
 app/views/projects/notes/_edit_form.html.haml | 10 +---------
 app/views/projects/notes/_form.html.haml      |  8 --------
 3 files changed, 1 insertion(+), 30 deletions(-)

diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 1c090bd06dc..90e6fd6d154 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -39,9 +39,6 @@ class @Notes
     # reset main target form after submit
     $(document).on "ajax:complete", ".js-main-target-form", @resetMainTargetForm
 
-    # attachment button
-    $(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
 
@@ -73,7 +70,6 @@ class @Notes
     $(document).off "click", ".js-note-delete"
     $(document).off "click", ".js-note-attachment-delete"
     $(document).off "ajax:complete", ".js-main-target-form"
-    $(document).off "click", ".js-choose-note-attachment-button"
     $(document).off "click", ".js-discussion-reply-button"
     $(document).off "click", ".js-add-diff-note-button"
     $(document).off "visibilitychange"
@@ -173,15 +169,6 @@ class @Notes
 
     form.find(".js-note-text").data("autosave").reset()
 
-  ###
-  Called when clicking the "Choose File" button.
-
-  Opens the file selection dialog.
-  ###
-  chooseNoteAttachment: ->
-    form = $(this).closest("form")
-    form.find(".js-note-attachment-input").click()
-
   ###
   Shows the main form and does some setup on it.
 
diff --git a/app/views/projects/notes/_edit_form.html.haml b/app/views/projects/notes/_edit_form.html.haml
index 4ba59078318..ca097f3d55a 100644
--- a/app/views/projects/notes/_edit_form.html.haml
+++ b/app/views/projects/notes/_edit_form.html.haml
@@ -11,12 +11,4 @@
     .note-form-actions
       .buttons
         = f.submit 'Save Comment', class: "btn btn-primary btn-save btn-grouped js-comment-button"
-        = link_to  'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
-
-      .note-form-option.hidden-xs
-        %a.choose-btn.btn.js-choose-note-attachment-button
-          %i.fa.fa-paperclip
-          %span Choose File ...
-        &nbsp;
-        %span.file_name.js-attachment-filename
-        = f.file_field :attachment, class: "js-note-attachment-input hidden"
+        = link_to  'Cancel', "#", class: "btn btn-cancel note-edit-cancel"
\ No newline at end of file
diff --git a/app/views/projects/notes/_form.html.haml b/app/views/projects/notes/_form.html.haml
index 9f9efc782d5..8b331ef819f 100644
--- a/app/views/projects/notes/_form.html.haml
+++ b/app/views/projects/notes/_form.html.haml
@@ -20,13 +20,5 @@
       = yield(:note_actions)
       %a.btn.grouped.js-close-discussion-note-form Cancel
 
-    .note-form-option.hidden-xs
-      %a.choose-btn.btn.js-choose-note-attachment-button
-        %i.fa.fa-paperclip
-        %span Choose File ...
-      &nbsp;
-      %span.file_name.js-attachment-filename
-      = f.file_field :attachment, class: "js-note-attachment-input hidden"
-
 :javascript
   window.project_uploads_path = "#{project_uploads_path @project}";
-- 
GitLab