Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kuboon
Created July 26, 2012 08:15
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save kuboon/3180918 to your computer and use it in GitHub Desktop.
Save kuboon/3180918 to your computer and use it in GitHub Desktop.
glyph icon helper for twitter-bootstrap with Rails
module ApplicationHelper
# ==== Examples
# glyph(:share_alt)
# # => <i class="icon-share-alt"></i>
# glyph(:lock, :white)
# # => <i class="icon-lock icon-white"></i>
def glyph(*names)
content_tag :i, nil, class: names.map{|name| "icon-#{name.to_s.gsub('_','-')}" }
end
end
@CelsoDeSa
Copy link

works wonderfully!

<%= link_to glyph(:pencil) + ' Edit profile', edit_user_registration_path %>
<%= link_to  glyph(:"warning-sign") + " Logout", destroy_user_session_path, method: :delete %>

@Rongorongo
Copy link

Thanks, this helped me a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment