0

我“米试图呈现一个引导酥料饼的一个局部的form_for,而由于某种原因,形式似乎并没有被正确关闭,破酥料饼。轨形成局部断裂引导酥料饼

_post_form.html。 ERB

test_text_1 
<%= form_for(@reblog) do |f| %> 
    <%= f.text_field :content %> 
    <%= f.submit %> 
<% end %> 
test_text_2 

视图助手调用酥料饼和形式:

def reblog_post(reblog) 
    button_tag(class: "btn btn-xs", data: { toggle: "popover", placement: "bottom", html: true, content: (render partial: "shared/post_form") }) do 
     '<a><span class="glyphicon glyphicon-retweet"></span></a>'.html_safe 
    end 
    end 

的酥料饼的工作得很好,当有只纯文本或HTML,但只要我把form_fo中的R它,所述的form_for后一切(即,test_text_2,以及形式元素)呈现酥料饼之外,具有尾随">,这使得它看起来像表单字段没有被正确关闭沿。的形式(例如,test_text_1)之前,任何纯文本还是在表单内呈现正常。我失去了一个错字,还是有呈现在引导酥料饼的形式以特定的方式?

回答

1

相反

content: (render partial: "shared/post_form")

尝试:

content: "#{ render partial: 'shared/post_form' }"

您还希望确保popover初始化接受HTML内容(默认为纯文本),即$("#id").popover({html: 'true'})

http://getbootstrap.com/javascript/#popovers-options

干杯

+0

太好了,谢谢! –