Kiểm tra này ra:
API wrapper cũng không phải là tài liệu được nêu ra, nhưng tôi đã trải qua một thời gian cố gắng tìm nó ra. Đây là một ví dụ đơn giản, có thể được thiết lập bên trong bộ khởi tạo simple_form.
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a complete input.
# You can remove any component from the wrapper, change the order or even
# add your own to the stack. The options given to the wrappers method
# are used to wrap the whole input (if any exists).
config.wrappers :GIVE_YOUR_WRAPPER_A_NAME, :class => 'clearfix', :error_class => nil do |b|
b.use :placeholder
b.use :label
b.use :tag => 'div', :class => 'WHATEVER_YOU_WANT_TO_CALL_IT' do |ba|
ba.use :input
ba.use :error, :tag => :span, :class => :'help-inline'
ba.use :hint, :tag => :span, :class => :'help-block'
end
end
end
Sau đó, khi bạn tạo một hình thức chỉ định các wrapper bạn muốn sử dụng:
<%= simple_form_for @user, wrapper: 'WHATEVER_YOU_CALLED_YOUR_WRAPPER' do |form| %>
<%end%>
Hope this helps.
đó là! tôi không biết rằng bạn có thể xác định rõ ràng "sử dụng: đầu vào" để kiểm soát vị trí của thẻ đầu vào. Điều này nên được viết trong tài liệu. Tuyệt quá! –