blob: acd6289147c6566a8c84d182e19df3c8481ca24f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
define(['nunjucks'], function(nunjucks) {
var TEMPLATE_RENDERER = {
/*
* target: target HTML element can be an #id or .class.
* partialUrl : the url where specified partial exists.
* data : JSON object contains the data to be rendered.
* callback : The callback method that will be executed when
* template is successfull loaded
*/
render: function(target, partialUrl, data, callback) {
require(['text!' + partialUrl], function(template) {
var rendered = nunjucks.renderString(template, data);
$(target).html(rendered);
callback.call();
});
}
}
return TEMPLATE_RENDERER;
});
|