自定义 simple_form 个必需的标签
Customize the simple_form required label
我用 Google 搜索了很多,但似乎找不到明显的答案。简单表单将 <abbr title="required">*</abbr>
添加到必填字段的标签中。这太棒了 - 'awsomer' 可以将其更改为其他内容。我想到的是像 <i class="fa fa-check-square"></i>
.
这样的字体真棒图标一样简单的东西
您可以在 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>'
我用 Google 搜索了很多,但似乎找不到明显的答案。简单表单将 <abbr title="required">*</abbr>
添加到必填字段的标签中。这太棒了 - 'awsomer' 可以将其更改为其他内容。我想到的是像 <i class="fa fa-check-square"></i>
.
您可以在 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>'