Sketchybear
Sketchybear

Reputation: 67

Break out of the flow of divs in HAML

I've got a rails app in which a container div sits in the application layout (around the yield tag).

What I'd like to know is whether it's possible to break out of the container div within the views if I'm using HAML.

In standard HTML I could just close off the div and with a cheeky at the top of the view and the re-open it further down the code, but HAML's nesting doesn't allow this as the main container is set outside the views.

Any workarounds other than having to place the container into every view rather than in the main app layout?

Thanks.

Upvotes: 1

Views: 180

Answers (1)

Babur Ussenakunov
Babur Ussenakunov

Reputation: 1995

You can use filters :

In layout:

%div
  = yield

In template:

:plain
   </div>

# haml...

:plain
   <div>

Upvotes: 2

Related Questions