Slim templates on Ruby on Rails, what are best practices
For new line, you should just use br like:
h1 Line1 content
br
h1 Line2 content
And about the above mentioned code, it can be rewrite like this:
-provide(:title,@course.title)
.row
aside.span4
section
h1 = @course.title.capitalize
= link_to t('ui.edit'), edit_course_path(@course)
'|
= link_to t('ui.back'), courses_path
p
b = t('activerecord.attributes.subject.title')
|:
= @course.subject.title
p
b = t('activerecord.attributes.student_level.title')
|:
= @course.student_level.title
h4 = t('activerecord.attributes.course.objectives')
= @course.objectives
To insert br tag into some tag in slim:
Example 1. Slim template:
h1
| Hello
br
| world
It will produce html:
<h1>Hello<br>world</h1>
Example 2. Fragment of slim template for displaying form:
p
= f.label :title
br
= f.text_field :title
It will produce html:
<p>
<label for="question_title">Title</label><br>
<input name="question[title]" id="question_title" type="text">
</p>