Skip to content

Using curly for layouts

Daniel Schierbeck edited this page Jul 9, 2013 · 1 revision

Curly can be used for layout views just as easily as for normal views and partials.

<!-- app/views/layouts/application.html.curly -->
<!DOCTYPE html>
<html>
<head>
  <title>{{title}}</title>

  {{stylesheet_link}}
</head>
<body>
  {{content}}
</body>
</html>
# app/presenters/layouts/application_presenter.rb
class Layouts::ApplicationPresenter < Curly::Presenter
  def title
    "My blog"
  end

  def stylesheet_link
    stylesheet_link_tag "application"
  end

  def content
    yield
  end
end
Clone this wiki locally