pivotal/erector — Issue #28: Mixing erector with views
Author: joevandyk
Created: 2012-01-10 01:19:12+00:00
State: open

it would be really nice to be able to do something like this from inside views:

```
class ContentSectionWidget < Erector::Widget
def content
div :class => 'content' do
# magic here
end
end

def header header_text
tab do
h1 header_text
end
end

def tab &block
span :class => 'tab', &block
end

def body
div :class => 'body', &block
end
end

# Haml

= ContentSectionWidget.new do |w|
= w.header "Blah blah"
%p Some haml here
= w.body do
%p Some more haml body here
```

We are slowly moving from haml to erector, but we don't want to make a new erector class for every single view in the system yet. Being able to do something like the above where we can interoperate with erector from inside haml (or erb) woud be useful.

I've tried to come up with a simple way to do this, but haven't been able to yet. Thoughts?