[英]How do I change title and name button in f.has_many ? active_admin on rails
I want to change Title and name button in f.has_many
. 我想在f.has_many
更改标题和名称按钮。
I use active_admin on rails 我在rails上使用active_admin
This my code: 这是我的代码:
f.has_many :gallery_apps do |i|
i.input :img,:label => "New Screen Shot" ,:as => :file ,:multipart => true
end
Now Title is showing "Gallery app" and name button is "Add New Gallery App" 现在Title显示“Gallery app”,名称按钮是“Add New Gallery App”
How do I edit code? 如何编辑代码?
I think this may work for you 我认为这可能对你有用
f.has_many :gallery_apps, heading: "Gallery app" ,new_record: "Add New Gallery App" do |i|
i.input :img,:label => "New Screen Shot" ,:as => :file ,:multipart => true
end
You can control the displayed model name via locales. 您可以通过区域设置控制显示的模型名称。
For example, in /config/locales/en.yml: 例如,在/config/locales/en.yml中:
en:
activerecord:
models:
gallery_app:
one: "Screen Shot"
other: "Screen Shots"
Take a look at the simple_form gem https://github.com/plataformatec/simple_form . 看一下simple_form gem https://github.com/plataformatec/simple_form 。 It is a really good way to do forms. 这是表格的一种非常好的方式。 You can change the label by adding 您可以通过添加来更改标签
label: 'Your Label'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.