8000 Mixing erector with views · Issue #28 · erector/erector · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mixing erector with views #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionall 7C57 y send you account related emails.

Already on GitHub? Sign in to your account

Open
joevandyk opened this issue Jan 10, 2012 · 0 comments
Open

Mixing erector with views #28

joevandyk opened this issue Jan 10, 2012 · 0 comments

Comments

@joevandyk
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0