Right now templates can only be instantiated through a template_route, and there's no possibility for sub-templates, aka templates (or widgets I suppose?) instantiating another template. Fix that.
Create database procedure endpoint.bundled_template(bundle_name text, template_name text) which returns a un-rendered template, looked up by bundle name + name.
Create database procedure endpoint.template_render(bundle_name text, template_name text, args json) in language plv8 that grabs the template, renders it using supplied args, and returns its rendered string.
Since templates can call other templates, implement a Javascript function template(bundle_name, template_name, args) which kicks off to the database procedure in 1 via plv8. This function needs to be in plv8's scope. Which means we have to figure out how to do that. Right now template_render just one-off pulls in the required Javascript functions per-call, which is awful. Need a pattern here.
Right now templates can only be instantiated through a
template_route
, and there's no possibility for sub-templates, aka templates (or widgets I suppose?) instantiating another template. Fix that.endpoint.bundled_template(bundle_name text, template_name text)
which returns a un-rendered template, looked up by bundle name + name.endpoint.template_render(bundle_name text, template_name text, args json)
inlanguage plv8
that grabs the template, renders it using suppliedargs
, and returns its rendered string.template(bundle_name, template_name, args)
which kicks off to the database procedure in 1 via plv8. This function needs to be in plv8's scope. Which means we have to figure out how to do that. Right now template_render just one-off pulls in the required Javascript functions per-call, which is awful. Need a pattern here.