【问题标题】:Customize the simple_form required label自定义 simple_form 所需标签
【发布时间】:2015-11-11 07:17:29
【问题描述】:

我已经用 Google 搜索了很多,但似乎找不到明显的答案。简单表单将<abbr title="required">*</abbr> 添加到必填字段的标签中。这太棒了 - 'awsomer' 将能够将其更改为其他内容。我想到的是像<i class="fa fa-check-square"></i> 这样的字体真棒图标一样简单。

【问题讨论】:

    标签: ruby-on-rails simple-form


    【解决方案1】:

    您可以在 config/locales/simple_form.en.yml 中编辑它 - 取消注释 simple_form.required.html 行并将其更改为您的版本,例如:

    en:
      simple_form:
        ...
        required:
          text: 'required'
          mark: '*'
          # You can uncomment the line below if you need to overwrite the whole required html.
          # When using html, text and mark won't be used.
          html: '<i class="fa fa-check-square"></i>'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      • 1970-01-01
      • 2014-10-14
      • 2016-07-06
      • 1970-01-01
      • 2012-07-13
      相关资源
      最近更新 更多