soveran / cuba

Rum based microframework for web development.
http://cuba.is
MIT License
1.44k stars 248 forks source link

Add support for custom default layouts. #28

Closed kitop closed 10 years ago

kitop commented 10 years ago

Adds a Cuba.settings[:render][:layout] variable. This lets you set different layouts for different applications.

Cuba.plugin Cuba::Render

class Admins < Cuba
  settings[:render][:layout] = "admins_layout"

  on default do
    # Now this will render the home view inside the admins_layout layout
    res.write view("home", content: "hello, world")
  end

end

This is useful when having a Guests and an Admin app, where you'd like to show different layouts depending on the context without needing to specify it in every view call.