2014-09-02 24 views
0

我遵循API说明,但表单行为不会输出它在示例和示例源代码中应该说的内容。为什么不用bootstrap生成引导程序兼容的表单?

我安装了simpleform和bootstrap。 我做了rails g simple_form:install --bootstrap 我看到这些文件已经生成。

Simpleform说要为元素做代码像这样

= simple_form_for @park, html: { multipart: true, role: "form", class: "form-horizontal" } do |f| 
    - if @park.errors.any? 
    #error_explanation 
     %h2= "#{pluralize(@park.errors.count, "error")} prohibited this park from being saved:" 
     %ul 
     - @park.errors.full_messages.each do |msg| 
      %li= msg 

    = f.input :address, label: 'address', autofocus: true, placeholder: "123 Fake Street Irvine, CA 90123", class: "form-control" 

的形式简单的输出越来越那种可笑的DSL的层。

很多事情错的输出 1)包装类不举的form-group匹配,而是它仍然controls 2)形式不伸出宽度为100%像它应该。 3)如果输入未被检测为“必需”,则标签不会被包裹,而是粘到屏幕的左侧。

API为什么不起作用?

回答

0

自举的简单形式生成命令生成的配置文件初始化为引导2.X

因此,你必须修改初始化文件吐出适当的类。

请参阅此问题的答案。

Bootstrap3 and simple form

相关问题