alxppp
alxppp

Reputation: 107

Pass HAML content to HAML partial

In Rails/HAML I have the following partial:

.blur
  .blur.underground= text
  .blur.foreground
    = yield

It draws blurred out text in the underground and (should) draw the yielded content in the foreground. Unfortunately, when I call

= render 'partial name' do
  %h1 xyz

the '%h1 xyz' is not inserted in my partial.

Am I doing something wrong or is there an alternative way to achieve this?

Upvotes: 1

Views: 634

Answers (1)

JTG
JTG

Reputation: 8846

This worked for me

= render layout: 'partial name' do
  %h1 xyz

(note the 'layout') and then

.blur
  .blur.underground= text
  .blur.foreground
    = yield

produced

div class="blur">
  <div class="blur underground">text</div>
  <div class="blur foreground">
    <h1>xyz</h1>
  </div>
</div>

Upvotes: 3

Related Questions