Add template rendering to widget

This commit is contained in:
Lawrence Elitzer 2020-08-29 09:04:59 -05:00
parent 7a765018f2
commit e3c11476fb

View file

@ -331,14 +331,15 @@ router.getAsync('/:cid/widget', cors(corsOptions), async (req, res) => {
subscribeUrl: getPublicUrl(`subscription/${list.cid}/subscribe`),
hasPubkey: !!configItems.pgpPrivateKey,
customFields: await fields.forHbs(contextHelpers.getAdminContext(), list.id),
template: {},
template: 'subscription/widget-subscribe.hbs',
layout: null,
};
await injectCustomFormData(req.query.fid || list.default_form, 'web_subscribe', data);
const renderAsync = bluebird.promisify(res.render.bind(res));
const html = await renderAsync('subscription/widget-subscribe', data);
const htmlRenderer = await tools.getTemplate(data.template, req.locale);
const html = htmlRenderer(data);
const response = {
data: {