更改活动管理员 has_many_remove 按钮的文本?

change text of active admin has_many_remove button?

如何将活动管理员 f.has_many 节上的删除(分配给 class 'has_many_remove')按钮上的文本从 'Remove' 更改为 'Hide'?仅适用于当前 page/model 而不是全站范围。

对于application-wide改变,你只需要在config/locales/en.yml里面添加以下内容:

en:
  active_admin:
    has_many_remove: "Hide"

但是对于页面特定的更改,您需要 JS 的帮助。

p.s。如果你能提供你的具体需求,我可以用js解决方案更新答案。

我确认 Active Admin 中缺少此功能,请参阅 Active Admin github 存储库问题部分中的讨论:https://github.com/activeadmin/activeadmin/issues/5283