Mailtrain-org / mailtrain

Self hosted newsletter app
GNU General Public License v3.0
5.53k stars 692 forks source link

Question: JSON grouped custom fields #241

Closed jdfx closed 7 years ago

jdfx commented 7 years ago

Amazing project, this is exactly what I need.

I plan on extending this as much as possible for some greater automation features, creating lists and campaigns programatically and such.

I wonder if you could explain this feature in a litte more detail:

"For group elements like checkboxes you can control the appearance of the merge tag with an optional template. The template uses handlebars syntax and you can find all values from {{values}} array, for example {{#each values}} {{this}} {{/each}}. If template is not defined then multiple values are joined with commas. You can also use this template to render JSON values (if the JSON is an array then the array is exposed as values, otherwise you can access the JSON keys directly)."

So is this saying that, the field can be passed a JSON array and then I have to dictate how that field is represented in the email template here, I can't access the JSON array in the template editor?

witzig commented 7 years ago

@jdfx, see here: https://github.com/Mailtrain-org/mailtrain/wiki/JSON-data

So is this saying that [...] I can't access the JSON array in the template editor?

Correct. You can't access them in the "template editor" (Ace/SummerNote/GrapeJS/Mosaico), but in the template textarea of the custom field. It's like a partial you then call with the merge tag.

jdfx commented 7 years ago

Understood, thanks.