No release in over 3 years
Low commit activity in last 3 years
Return font awesome icon based on filename.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Font Awesome file icons

Sometimes you need to output filename with an icon from font-awesome. And you need to take an extension of file and use some mapping.

This gem is doing this for you, so you can focus on more important things.

Usage

Gem is adding method-wrapper fa_file_icon which behaves very similar to fa_icon and can receive same arguments as fa_icon.

<p><%= fa_file_icon 'file.pdf', text: 'download' %></p>
<p><%= fa_file_icon 'movie.avi' %></p>
<p><%= fa_file_icon 'attachment.zip' %></p>
<p><%= fa_file_icon user.avatar.file.filename, text: user.avatar.file.filename %></p>

<p><%= fa_file_stacked_icon 'index.mov', text: 'mov' %></p>
<p><%= fa_file_stacked_icon 'index.jpg', text: 'jpg' %></p>
<p><%= fa_file_stacked_icon 'index.bmp', text: 'bmp', class: "fa-5x" %></p>

Installation

Add this line to your application's Gemfile:

gem 'font_awesome_file_icons'

And then execute:

$ bundle

Gem depends on font-awesome-rails and mimemagic gems.

Contributing

  • Fork
  • git clone
  • cd test/dummy
  • rails s
  • open localhost:3000
  • make fixes in lib folder, restart server
  • push changes & send a PR

License

The gem is available as open source under the terms of the MIT License.