-
Notifications
You must be signed in to change notification settings - Fork 1
Templates
Jodi Winters edited this page Jul 28, 2016
·
1 revision
The template engine is built into the Alephant::Views::HTML class. In a model, create methods that correspond to variables, and they will become available to the template.
There are two template paths in Alephant, the template path and the partials path. By default in HTML renderers, the template path is ../templates/ from your model, and the partials path is ../../lib/templates from your model. You can change either of these pathing strategies by overriding the default renderer_engine instantiation.
def renderer_engine
partial_path = File.join(base_path, 'templates/')
Alephant::Renderer::Engine::Mustache.new(base_path, template_name, partial_path)
endIn the above example, base_path is the parent of the current model folder, so this will make the partials path equal to the template path.