No commit activity in last 3 years
No release in over 3 years
Brings Simple Form file inputs in line with the other Bootstrap themed fields
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0

Runtime

 Project Readme

Gem Version

SimpleStrapFile

Simple Form component that provides a pretty file input using Twitter Bootstrap for styling.

Based on 'Whipping File Inputs Into Shape with Bootstrap 3' by Cory LaViska.

Installation

Prerequisites

It is assumed you have installed Bootstrap and Simple Form already

Ensure you have applied Bootstrap styling to Simple Form using:

rails generate simple_form:install --bootstrap

Gem

Add gem 'simple_strap_file' to your application's Gemfile and run bundle.

Assets

Import styling in app/assets/stylesheets/application.css:

*= require simple_strap_file

Require Javascripts in app/assets/javascripts/application.js

//= require simple_strap_file

Tips

If you are using Paperclip and have an avatar column you can use the following in your form:

<%= f.input :avatar, input_html: { value: f.object.avatar_file_name, readonly: true } %>

This will also show the filename when the form is shown in the edit view.

Contributing

  1. Fork it (https://github.com/michaelcowan/simple_strap_file/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request