In the meantime, I came up with this ugly hack to a) hide “checkbox” answers, and b) display non-textarea questions on the same line (<question?>: <answer>
) and c) fix spacing between items
If you’re somewhat familiar with Javascript, you can adapt it to your needs:
(This is to be added in app.yml
’s hooks section)
hooks:
after_code:
- exec:
# Typically here you have the plugin thingies
- replace:
filename: /var/www/discourse/app/assets/javascripts/discourse/app/lib/form-template-validation.js
from: 'return formattedOutput.join("\n\n");'
to: |
const formattedOutput2 = mergedData.map((item) => {
const key = Object.keys(item)[0];
const value = item[key];
const type = formTemplate.find(x => x.id == key).type;
if (type == 'checkbox') return;
if ((value) && (type != 'textarea')) return `**${labelMap[key]}**: ${value}`;
if (value) return`\n### ${labelMap[key]}\n${value}\n`;
});
return formattedOutput2.join("\n");