Rails: How to add spinner to Upload button when using Paperclip?
This is my form to upload images using Paperclip gem:
<%= form_for(@user, :html => { :multipart => true }) do |f| %>
<%= f.file_field :avatar %><br>
<%= f.submit "Upload", class: "button" %><br>
<% end %>
In my Controller:
def update
if @user.update_attributes(params[:user])
redirect_to :back
else
redirect_to :back, notice: "Avatar must not exceed 1MB."
end
end
How do I add a spinner to the upload button when the User uploads an
image? It takes about 8-10 seconds to upload an image, hence I'd like the
spinner to show while uploading. If not on the upload button itself,
somewhere on the page at least.
No comments:
Post a Comment