summaryrefslogtreecommitdiff
path: root/web-ui/app/js/views/recipientListFormatter.js
blob: c3d058588f486836a3f32e8c632a183208c734bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*global Handlebars */

define(function() {
  'use strict';
  Handlebars.registerHelper('formatRecipients', function (header) {
    function wrapWith(begin, end) {
      return function (x) { return begin + x + end; };
    }

    var to = _.map(header.to, wrapWith('<span class="to">', '</span>'));
    var cc = _.map(header.cc, wrapWith('<span class="cc">cc: ', '</span>'));
    var bcc = _.map(header.bcc, wrapWith('<span class="bcc">bcc: ', '</span>'));

    return new Handlebars.SafeString(to.concat(cc, bcc).join(', '));
  });
});