我有以下代码:
config.wrappers :file, tag: 'div', class: 'control-group', error_class: 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper tag: 'div', class: 'controls uploader' do |input|
input.use :input
input.use :hint, wrap_with: { tag: 'span', class: 'filename' }
input.use :hint, wrap_with: { tag: 'span', class: 'action' }
input.use :hint, wrap_with: { tag: 'span', class: 'help-block' }
input.use :error, wrap_with: { tag: 'span', class: 'help-inline' }
end
是否可以执行以下操作:
input.use :hint, wrap_with: { tag: 'span', class: 'action', text: 'choose a file' }
或在输入中指定提示,如:
<%= o.input :name,
as: :file,
wrapper: :file,
label: 'Brand',
required: false ,
hint_<specific>: 'Text...'%>
答案 0 :(得分:0)
根据此文档https://github.com/plataformatec/simple_form#i18n 您可以在单独的文件中设置提示的文本
所以我认为你需要一个像这样的单独文件
en:
hints:
file:
thing1: 'hint for thing 1'
thing2: 'hint for thing 2'