Package com.morpheusdata.views
Class HandlebarsRenderer
java.lang.Object
com.morpheusdata.views.HandlebarsRenderer
- All Implemented Interfaces:
Renderer<com.github.jknack.handlebars.Handlebars>
public class HandlebarsRenderer
extends Object
implements Renderer<com.github.jknack.handlebars.Handlebars>
HandlebarsRenderer implements the Renderer interface.
It uses a Dynamic template loader and Handlebars engine to render templates.
-
Constructor Summary
ConstructorDescriptionHandlebarsRenderer
(com.github.jknack.handlebars.Handlebars overrideEngine) HandlebarsRenderer
(ClassLoader classLoader) HandlebarsRenderer
(String prefix) HandlebarsRenderer
(String prefix, ClassLoader classLoader) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTemplateLoader
(ClassLoader classLoader) Add a child first class loadercom.github.jknack.handlebars.Handlebars
The implementation of the actual engine to be used in this rendererIterable<com.github.jknack.handlebars.io.TemplateLoader>
Get a list of all template loadersvoid
registerAssetHelper
(String pluginName) Creates an {{asset}} helper tag that outputs the plugin specific relative url for assets stored in the /src/assets e.g.void
registerI18nHelper
(Plugin plugin, MorpheusContext morpheus) void
registerNonceHelper
(MorpheusWebRequestService requestService) void
removeTemplateLoader
(ClassLoader classLoader) Remove a class loaderGiven a template and a model, returns a TemplateResponserenderTemplate
(String location, ViewModel<?> model) Given a template location and a model, returns a TemplateResponse
-
Constructor Details
-
HandlebarsRenderer
public HandlebarsRenderer() -
HandlebarsRenderer
-
HandlebarsRenderer
-
HandlebarsRenderer
-
HandlebarsRenderer
public HandlebarsRenderer(com.github.jknack.handlebars.Handlebars overrideEngine)
-
-
Method Details
-
addTemplateLoader
Add a child first class loader- Specified by:
addTemplateLoader
in interfaceRenderer<com.github.jknack.handlebars.Handlebars>
- Parameters:
classLoader
- plugin class loader
-
removeTemplateLoader
Remove a class loader- Specified by:
removeTemplateLoader
in interfaceRenderer<com.github.jknack.handlebars.Handlebars>
- Parameters:
classLoader
- plugin class loader
-
getTemplateLoaders
Get a list of all template loaders- Specified by:
getTemplateLoaders
in interfaceRenderer<com.github.jknack.handlebars.Handlebars>
- Returns:
- list of template loaders
-
render
Description copied from interface:Renderer
Given a template and a model, returns a TemplateResponse -
renderTemplate
Description copied from interface:Renderer
Given a template location and a model, returns a TemplateResponse- Specified by:
renderTemplate
in interfaceRenderer<com.github.jknack.handlebars.Handlebars>
- Parameters:
location
- Location where the engine can find the template.model
- ViewModel to be passed in with the template- Returns:
- TemplateResponse
-
getEngine
public com.github.jknack.handlebars.Handlebars getEngine()Description copied from interface:Renderer
The implementation of the actual engine to be used in this renderer -
registerAssetHelper
Creates an {{asset}} helper tag that outputs the plugin specific relative url for assets stored in the /src/assets e.g.<link href="{{asset "/custom.css"}}" />
- Parameters:
pluginName
- name of the plugin- See Also:
-
registerNonceHelper
-
registerI18nHelper
-