Skip to content

A Simple Form component that provides a pretty file input using Bootstrap

License

Notifications You must be signed in to change notification settings

michaelcowan/simple_strap_file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Simple Form component that provides a pretty file input using Bootstrap

Resources

License

Stars

Watchers

Forks

Packages

No packages published