I am attempting the following
A HAML template with
#whitepanelMID
#groups_view_scroller
= render 'show' do
= render 'short_field', locals: {label: 'Name:', value: @group.name}
= render 'short_field', locals: {label: 'Description:', value: @group.description}
And the partials are _show.html.haml (note the use of yield)
%table#vert_table.no_borders{ cellpadding: '0', cellspacing: '0'}
%tbody
%tr
%td{ cols: 2 } My table
= yield
and _short_field.html.haml
%tr
%th.vert_table_heads= label
%td= value
The issue is that yield does not seem to work.
What's the proper way to use block in render
in HAML?
Update
I found a workaround, which I don't like.
In the HAML template capture the output like
#whitepanelMID
#groups_view_scroller
- rows = capture_haml do
= render partial: 'short_field', locals: {field_label: 'Name:', value: @group.name}
= render partial: 'short_field', locals: {field_label: 'Site:', value: @group.site.description}
= render partial: 'show', locals:{ content: rows}
%br/
with the modified partial _show.html.haml with a content
variable instead of yield
%table#vert_table.no_borders{ cellpadding: '0', cellspacing: '0'}
%tbody
%tr
%td{ cols: 2 } My table
!= content
Happy to hear a better approach!