Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Introduce a (mail-) templating #78

Open
4 tasks
aeimer opened this issue May 9, 2017 · 1 comment
Open
4 tasks

Introduce a (mail-) templating #78

aeimer opened this issue May 9, 2017 · 1 comment
Labels
enhancement This issue improves geli future This issue will be solved in a another release

Comments

@aeimer
Copy link
Collaborator

aeimer commented May 9, 2017

User Story

As a:

Programmer

I want:

to have a templating engine in the backend

so that:

I can easier and cleaner create and maintain templates for e.g. (html) mails

Storypoints:

?

Acceptance criteria:

  • templates stored under e.g. api/src/templates/mail/ can be rendered
  • variables can be passed to the value
    • object-values from a passed value can be accessed (nested)
  • a wrapper template can be defined in the render-function (this may be useful to create a tempalte file for the message and a wrapper-file to define some kind of html markup stuff)

Additional info:

The module mini-template-engine looks pretty good for this task.

Some kind of example code may be this:

class Templating {
  private $wrapper = '<div>add here some cool styled css/html stuff<div class="content">[[CONTENT]]</div></div>';
  private $activation = 'Hi {user.name}, please click {activationlink}. CU';

  public static function render($template, $html = false, array $attributes) {
    // todo check if template exists
    $input = $template_content; // MAGIC: this is the content of eg $activation for $template = 'activation'
    if ($html) {
      strreplace('[[CONTENT]]', $wrapper, $input);
    }
    $output = TinyTmpl.render($input, $attributes);
    return $output;
  }
}

but instead of getting the content from the variables we should read them from the template-files.

@aeimer aeimer added the enhancement This issue improves geli label May 9, 2017
@aeimer aeimer added this to the Release 0.2 milestone May 9, 2017
@grosspersky
Copy link
Collaborator

An other possible candidate for this task could be https://github.com/crocodilejs/node-email-templates

Some predefined templates can be found here: https://github.com/mailgun/transactional-email-templates

@aeimer aeimer removed this from the Release 0.2 milestone May 11, 2017
@PatrickSkowronek PatrickSkowronek added the future This issue will be solved in a another release label Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement This issue improves geli future This issue will be solved in a another release
Projects
None yet
Development

No branches or pull requests

3 participants