LinkWithIcon
Keep your link_to
calls simple and readable, even when using icons.
<%= link_with_icon(:flag, 'Link Name', 'www.google.com') %>
# => <a href="www.google.com"><i class="icon-flag"></i>Link Name</a>
Installation
Add this line to your application's Gemfile:
gem 'link_with_icon'
And then execute:
$ bundle
Or install it yourself as:
$ gem install link_with_icon
Usage
Using link_with_icon
is as simple as pie:
<%= link_with_icon(:globe, 'A Link!', root_path) %>
It can handle all the normal options of the Rails link_to
helper.
<%= link_with_icon(:arrow, 'Click Me', another_awesome_path, onclick: 'alert("things");') %>
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request