I am having trouble trying to make a play button using HAML.
=button_tag clue_path(@question), class: "btn btn-lg glyphicon glyphicon-play"
Results in html
<button><icon class:"glyphicon glyphicon-play">/question/1/clue</i></button>
It should be
<button><icon class: "glyphicon glyphicon-play"></i></button>
I'm super close to resolving it. What am I missing?
If you're looking to put an icon inside a button with Bootstrap and HAML, try:
%button.btn.btn-lg.btn-default
%i.glyphicon.glyphicon-play
a button tag doenst have a href attribute.
you use a-tags style them like a button.
also i recommend you to use "fontawesome" instead of glyphicon. the integration is super easy, just add the gem and tell bootstrap to use FA.
list of icons is here: https://fortawesome.github.io/Font-Awesome/icons/
for the button do this
=link_to clue_path(@question), class: "btn btn-lg" do
%i.glyphicon.glyphicon-play
if you are using the font-awesome gem then its just
=link_to clue_path(@question), class: "btn btn-lg" do
=icon "glyphicon-play"
or
=link_to icon("glyphicon-play"), clue_path(@question), class: "btn btn-lg"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With