ruby on rails - How to format f.submit with css, glyphicons, and symbol? -
how can make this: <%= f.submit :conceal %>
work <span class="glyphicon glyphicon-plus">
, word private
, , class: "btn"
.
here attempts:
#this didn't make :conceal work <%= button_tag(type: 'submit', class: "btn") %> <% :conceal %><span class="glyphicon glyphicon-plus"></span> private <% end %> #this stopped :conceal working <%= f.submit "private", class: "btn" %> <% :conceal %> <% end %> #this ignored 2nd line despite, <%= f.submit :conceal, class: "btn" %> <span class="glyphicon glyphicon-plus"></span> private <% end %>
in controller:
if (params[:commit] == 'conceal') @valuation.conceal = true end
i'm afraid can't achieve button's appearance icon when using input[type=submit]
.
you have go button
. please, consider following:
<%= button_tag(type: "submit", class: "btn", name: "commit", value: "conceal") %> <span class="glyphicon glyphicon-plus"></span> private <% end %>
which generates html similar to:
<button name="commit" type="submit" class="btn" value="conceal"> <span class="glyphicon glyphicon-plus"></span> private </button>
hope helps!
Comments
Post a Comment