Saj*_*ani 2 haml ruby-on-rails
因为我不希望我的任何行超过80列,所以我想将最后一行拆分为两行.在行尾添加逗号按照此处的建议工作,但逗号后面会出现逗号.使用HAML有一个很好的清洁方法吗?
- if object.errors.any?
%section.form_error_message
%h4.form_error_message__title
= "#{pluralize(object.errors.size, 'errors')} prevented this form from submitting. Please fix these errors and try again."
Run Code Online (Sandbox Code Playgroud)
我希望所有内容都隐藏在80个列中,就像它们位于此屏幕截图的左侧一样.
mat*_*att 15
- if object.errors.any?
%section.form_error_message
%h4.form_error_message__title
= "#{pluralize(object.errors.size, 'errors')} prevented this form from |
submitting. Please fix these errors and try again." |
Run Code Online (Sandbox Code Playgroud)
在这种情况下你不需要这个,你可以直接在纯文本中使用插值,你不需要=:
- if object.errors.any?
%section.form_error_message
%h4.form_error_message__title
#{pluralize(object.errors.size, 'errors')} prevented this form from
submitting. Please fix these errors and try again.
Run Code Online (Sandbox Code Playgroud)
(这个输出略有不同,因为它将包含换行符.你应该注意到在渲染的HTML中,除非你是例如内部<pre>标记.)
| 归档时间: |
|
| 查看次数: |
4331 次 |
| 最近记录: |