lib/cuba/render.rb in cuba-3.1.0 vs lib/cuba/render.rb in cuba-3.1.1
- old
+ new
@@ -3,16 +3,17 @@
class Cuba
module Render
def self.setup(app)
app.settings[:render] ||= {}
app.settings[:render][:template_engine] ||= "erb"
+ app.settings[:render][:layout] ||= "layout"
app.settings[:render][:views] ||= File.expand_path("views", Dir.pwd)
app.settings[:render][:options] ||= {
default_encoding: Encoding.default_external
}
end
- def view(template, locals = {}, layout = "layout")
+ def view(template, locals = {}, layout = settings[:render][:layout])
partial(layout, { content: partial(template, locals) }.merge(locals))
end
def template_path(template)
"%s/%s.%s" % [