舒适的墨西哥沙发 comfy_form_for 删除表格标签

Comfy Mexican Sofa comfy_form_for remove form labels

有谁知道如何删除表单标签?我试过:

<%= comfy_form_for @comment, :as => :comment, options: {label: false}, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form| %>

还有

<%= comfy_form_for @comment, :as => :comment, default: {label: false}, :url => comfy_blog_comments_path(@cms_site.path, @blog.path, @post.slug) do |form| %>

还有

<%= form.text_field :email, label: false, :class => 'form-control' %>

都无济于事...

ComfortableMexicanSofa 正在使用 https://github.com/bootstrap-ruby/rails-bootstrap-forms

所以我认为你需要这样做:

<%= f.text_area :email, hide_label: true %>

同样对于那些想要从 DOM 中完全删除标签的人,这里是实现它的方法,根据 rails-bootstrap-forms 文档,您应该执行以下操作:

HTML:

 <%= form.text_area :content, :class => 'form-control', :rows => 5, placeholder: "Your comment", label_class: "removed-label" %>

CSS:

.removed-label {
  display: none;
}

希望它能帮助下线的人。