Comments (5)
This is an ugly way of doing it, but you can make it into a helper like icon_right('angle-double-right','Next')
, but the below does allow for the icon to show on the right.
<%= link_to "Next #{icon('angle-double-right')}".html_safe, "#", class: 'btn btn-default' %>
from font-awesome-sass.
The font-awesome-rails
gem has similar functionality, implemented as follows:
= icon('arrow-right', 'Login', right: true) # Login <i class="fa fa-arrow-right"></i>
from font-awesome-sass.
bump
from font-awesome-sass.
I'm assuming there's been no resolution to this issue?
from font-awesome-sass.
I'm assuming there's been no resolution to this issue?
Looking at the font-awesome-rails helper as well as this gems helper.
The solution below is working as a replacement allowing you to add the option to position the icon to the right of any text.
fa_icon('fab', 'font-awesome', 'Font Awesome', id: 'my-icon', class: 'strong', right: true)
def fa_icon(style, name, text = nil, html_options = {})
text, html_options = nil, text if text.is_a?(Hash)
content_class = "#{style} fa-#{name}"
content_class += " #{html_options[:class]}" if html_options.key?(:class)
html_options[:class] = content_class
icon = content_tag(:i, nil, html_options)
right_icon = html_options.delete(:right)
icon_join(icon, text, right_icon)
end
private
def icon_join(icon, text, reverse_order = false)
return icon if text.blank?
elements = [icon, ERB::Util.html_escape(text)]
elements.reverse! if reverse_order
safe_join(elements, ' ')
end
from font-awesome-sass.
Related Issues (20)
- Accessibility Issue: Choice in Tags
- Not compatible with non-root applications HOT 2
- Where is 5.8.2?
- Layout Issue w/ Duotone HOT 1
- 404 link on README - getting started HOT 1
- Update to 5.12.0 HOT 1
- How to rebuild fa-spin to control how it works? HOT 1
- no git tag for 5.13.0 so file-diff is not appeared at dependabot HOT 3
- Issues when using @use
- Preload
- Check if icon name exists / get list of all icon names
- Some icons do not show in Chrome when using the ruby gem in development
- Error: Can't find stylesheet to import. in rails 7 HOT 5
- Font Awesome v6 HOT 2
- Missing documentation about removal of font-awesome-sprockets HOT 4
- Only "fas fa" icons appear
- Switch to dart sass HOT 5
- Fonts not loading with dart sass in Rails 7 HOT 6
- gem files not found during assets:precompile HOT 1
- Missing releases on github?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from font-awesome-sass.