1

下の私のアプリの画像を見ると、最初のボタンにはグリフ アイコン (再生アイコン) がなく、2 番目のボタンにはあることがわかります。下のボタンのように、最初のボタンにグリフアイコンを配置するのを手伝ってもらえますか?

ここに画像の説明を入力

この投稿Ruby on Rails のボタンに Bootstrap アイコンを追加すると、このUsing link_to with embedded HTMLは私にとってはうまくいきませんでした。これは、最初と 2 番目のボタンのコードです。

      <div>
      <blockquote class="pull-left">
      <p id="joke_section">
      <%= @l.content %>
      </p>
      <small><%= @l.author %> </small>

      <%= button_to "Następny", random_joke_path, {remote: true, class: "btn btn-small"} %>


      </blockquote>
      </div>

      </div>

</div>

<div><blockquote class="pull-left">
  <p id="mycontainer"><%= @l.content %> </p>
  <small><%= @l.author %> </small>
  <button id="but" class="btn btn-small", "pull=right" type="button">
      Następny <i class="icon-play"></i>
  </button>

</blockquote></div>
4

2 に答える 2

7

これが動作しますbutton_to

<%= button_to random_joke_path, {remote: true, class: "btn btn-small"} do %>
       Następny <i class="icon-play"></i>
<% end %>
于 2013-12-14T21:01:01.877 に答える
2

あなたはブートストラップ2を使用していますか?わかります<i class="icon-play"></i>か?そのクラスは、そこに画像を取得するものです。だからあなたのレールコードで...

<%= link_to random_joke_path, class: "btn btn-small", remote: true do %>
  Następny <i class="icon-play"></i>
<% end %>

私はそれがあなたのために働くと思います。

于 2013-12-14T20:52:43.130 に答える