我将 Bootstrap 与我的 Rails 应用程序一起使用,我想创建一个按钮组,其中包含使用<%=button_to%>
.
这就是我所拥有的:
<div class="btn-group icons">
<%= button_to(raw("<i class='icon-undo'></i>"), project_steps_path(@project), :method=>:post, :class=> "btn undoIcon disabled", :title=>"undo" )%>
<button class="btn reorderIcon" title="reorder steps"><%=image_tag("icons/reorder_icon.png")%></button>
<button class="btn expandIcon" title="expand"><i class="icon-fullscreen"></i></button>
</div>
我希望<%= button_to%>
生成类似于<button class=...>
html 的内容,但我得到了以下内容:
<div class="btn-group icons">
<form action="/projects/18/steps" class="button_to" method="post"><div><input class="btn undoIcon disabled" title="undo" type="submit" value="<i class='icon-undo'></i>"><input name="authenticity_token" type="hidden" value="waRzPnaIUfWBt+sAAQR5STOnilLXhirOx/GaE1i1kFI="></div></form>
<button class="btn reorderIcon" title="reorder steps"><img alt="Reorder_icon" src="/assets/icons/reorder_icon.png"></button>
<button class="btn expandIcon" title="expand"><i class="icon-fullscreen"></i></button>
</div>
在我的页面上产生以下内容:
如何<%=button_to raw()%>
正确使用创建按钮?