2013-01-22 37 views
1

如果我嘗試使用引導程序的圖標類,則無法正確顯示。
任何人都知道如何顯示它?如何在RoR中顯示twitter引導程序圖標?

<%= f.submit nil, :class => 'btn btn-primary', :value => sanitize('<i class="icon-plus icon-white"></i> ') + 'Create!' if @community.new_record? %> 
+0

需要幫助。請。 – MKK

回答

3

glyphicon-halflings-white.png(白色圖標)必須在Rails應用程序的目錄app/assets/images。然後將<i class="icon-plus icon-white"></i>添加到您所需的視圖。

使用的圖標爲一個表單提交按鈕,一個塊傳遞給button_tag

<%= button_tag(type: 'submit', class: "btn btn-primary") do %> 
    <i class="icon-ok icon-white"></i> 
<% end %> 

來源:

+0

謝謝。一切都設定好了。然後我一直在使用它。我只是想知道如何在這種情況下使用圖標:) – MKK

+0

你的意思是使用圖標作爲表單提交按鈕?這裏有兩個relavent SO問題:http://stackoverflow.com/questions/11604304/add-html-tags-to-a-submit-button-text和http://stackoverflow.com/questions/10858582/html-code - 內部-按鈕與 - 簡單形式 – amacy

相關問題