diff --git a/app/assets/javascripts/gl_crop.js.coffee b/app/assets/javascripts/gl_crop.js.coffee index 4d990a6416a..6ab0afc184f 100644 --- a/app/assets/javascripts/gl_crop.js.coffee +++ b/app/assets/javascripts/gl_crop.js.coffee @@ -1,7 +1,12 @@ class GitLabCrop - constructor: (el, opts = {}) -> - # Input file - @fileInput = $(el) + constructor: (input, opts = {}) -> + @fileInput = $(input) + + # We should rename to avoid spec to fail + # Form will submit the proper input filed with a file using FormData + @fileInput + .attr('name', "#{@fileInput.attr('name')}-trigger") + .attr('id', "#{@fileInput.attr('id')}-trigger") # Set defaults { diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 2d9129470f8..dcb3be9585d 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -26,7 +26,7 @@ %a.btn.js-choose-user-avatar-button Browse file... %span.avatar-file-name.prepend-left-default.js-avatar-filename No file chosen - = f.file_field :avatar_dialog_trigger, class: "js-user-avatar-input hidden", accept: "image/*" + = f.file_field :avatar, class: "js-user-avatar-input hidden", accept: "image/*" .help-block The maximum file size allowed is 200KB. - if @user.avatar?