2013-02-08 36 views
1

我正在使用Rails窗體的超薄模板文件。我想在鏈接中使用Foundation圖標字體作爲圖形,但似乎無法找到將字體包含在link_to中的方法。這是有問題的代碼。超薄模板中的zurb基礎圖標字體link_to

h3 Categories 

table 
    tr 
    th <span class="secondary radius label">Category Name</span> 
    th colspan="2" <span class="secondary radius label">Actions</span> 
    - for category in @categories do 
    tr 
     td #{category.name} 
     td #{link_to 'Edit', edit_category_path(category)} <i class="general foundicon-edit"> 

在最後一行中,我能得到的圖標旁邊的鏈接(如圖所示)來顯示,但我看不出它嵌入鏈接標題本身(當前設置爲「編輯」 )。

任何幫助非常感謝!

僅供參考:: Rails的3.2.11和Ruby 1.9.3,基金會3

回答

0

沒有測試,但是這應該讓你接近:

td 
    = link_to edit_category_path(category) do 
     Edit <i class="general foundicon-edit"></i> 

這可能工作太:

td #{link_to 'Edit <i class="general foundicon-edit"></i>'.html_safe, edit_category_path(category)} 
+1

第二個選項工作正常,謝謝!第一個沒有,但我打算玩一下它,因爲它感覺像是一個更好的最終答案;-) – 2013-02-12 16:04:45