如何使用link_to创建一个包含令人敬畏的文本的按钮?

时间:2022-07-12 01:26:55
=link_to "p", movies_path, :id => dates, class: "fa fa-caret-left"

I'm trying to make a button to go back to the home page but display a different data. So I'm want to send a pramas. And it will be a button using the awesome text so it will be a left arrow.

我正在尝试按一个按钮返回主页但显示不同的数据。所以我想送一个pramas。它将是一个使用令人敬畏的文本的按钮,因此它将是一个左箭头。

1 个解决方案

#1


1  

=link_to movies_path, id: dates do 
  <i class = "fa fa-caret-left"></i>

if you want to have have the icon inside a button if you're using bootstrap for example you could do this inside your haml

如果你想在按钮内有图标,如果你正在使用bootstrap,例如你可以在你的haml中做到这一点

= link_to movies_path, id: dates do
  .btn.btn-info 
    %i.fa.fa-caret-left

Or reguler html.erb

或者是reguler html.erb

<%= link_to movies_path, id: dates do %>
  <div class="btn btn-info">
    <i class = "fa fa-caret-left"></i>
  </div>
<% end %>

Obviously make sure you've included font awesome probably with gem https://github.com/bokmann/font-awesome-rails

显然,确保你已经包含字体真棒可能与宝石https://github.com/bokmann/font-awesome-rails

#1


1  

=link_to movies_path, id: dates do 
  <i class = "fa fa-caret-left"></i>

if you want to have have the icon inside a button if you're using bootstrap for example you could do this inside your haml

如果你想在按钮内有图标,如果你正在使用bootstrap,例如你可以在你的haml中做到这一点

= link_to movies_path, id: dates do
  .btn.btn-info 
    %i.fa.fa-caret-left

Or reguler html.erb

或者是reguler html.erb

<%= link_to movies_path, id: dates do %>
  <div class="btn btn-info">
    <i class = "fa fa-caret-left"></i>
  </div>
<% end %>

Obviously make sure you've included font awesome probably with gem https://github.com/bokmann/font-awesome-rails

显然,确保你已经包含字体真棒可能与宝石https://github.com/bokmann/font-awesome-rails