如何更改活动管理员输入按钮文本
How to change Active Admin input button text
我的 ActiveAdmin 模型中有一个表单,我需要翻译为上传文件而生成的按钮的内容。
我有以下表格:
form do |f|
f.inputs 'Details' do
f.input :orders_file, as: :file
end
actions
end
其中显示:
我想翻译或更改 'Choose file' 和 'No file chosen' 文本。
我试过
input_html: { title: 'this', text: 'will', label: 'work', value: 'please' }
但运气不好。
谢谢!
您无法更改按钮和文本上的文件字段默认标签,它们在浏览器中是硬编码的。每个浏览器都有自己的方式来呈现这些东西。
更改这些标签的唯一方法是构建您自己的自定义文件字段控件。
更改文件上传字段标签涉及 Michael McGrady 发明的一些特殊技术,在 https://www.quirksmode.org/dom/inputfile.html
中有详细讨论
我的 ActiveAdmin 模型中有一个表单,我需要翻译为上传文件而生成的按钮的内容。
我有以下表格:
form do |f|
f.inputs 'Details' do
f.input :orders_file, as: :file
end
actions
end
其中显示:
我想翻译或更改 'Choose file' 和 'No file chosen' 文本。
我试过
input_html: { title: 'this', text: 'will', label: 'work', value: 'please' }
但运气不好。
谢谢!
您无法更改按钮和文本上的文件字段默认标签,它们在浏览器中是硬编码的。每个浏览器都有自己的方式来呈现这些东西。
更改这些标签的唯一方法是构建您自己的自定义文件字段控件。
更改文件上传字段标签涉及 Michael McGrady 发明的一些特殊技术,在 https://www.quirksmode.org/dom/inputfile.html
中有详细讨论