Bootstrap Refile

A bootstrap styled single file uploader for refile with progress bar and image preview.

Installation

Add this line to your application's Gemfile:

gem 'bootstrap_refile'

bundle install and restart your server to make the files available through the pipeline.

Add this line to your javascript file ( after //= require refile ):

//= require bootstrap_refile

Add this line to your stylesheet:

@import "bootstrap_refile";

Usage

<%= form_for @user do |form| %>
  <%= form.bootstrap_attachment_field :profile_image %>
<% end %>

If you want to change the style of the progress bar you can pass it in:

<%= form_for @user do |form| %>
  <%= form.attachment_field :profile_image, progress_class: 'progress-bar-danger' %>
<% end %>

Options:

  • progress_class
  • remove_class
  • select_class