1 |
efrain |
1 |
YUI.add('moodle-core-handlebars', function (Y, NAME) {
|
|
|
2 |
|
|
|
3 |
// Handlebars only exists in the global namespace and we do not want to
|
|
|
4 |
// Clone the entire thing.
|
|
|
5 |
|
|
|
6 |
// It should be reasonably safe within Moodle to add some core
|
|
|
7 |
// functionality to Handlebars at this level.
|
|
|
8 |
Y.Handlebars.registerHelper('get_string', function() {
|
|
|
9 |
var args = new Y.Array(arguments);
|
|
|
10 |
|
|
|
11 |
// Pop off the Handlebars object at the end.
|
|
|
12 |
args.pop();
|
|
|
13 |
|
|
|
14 |
// Add the Handlebars hashtable to support get_string arguments.
|
|
|
15 |
args.push(arguments[arguments.length - 1].hash);
|
|
|
16 |
|
|
|
17 |
// Perform the get_string.
|
|
|
18 |
return M.util.get_string.apply(this, args);
|
|
|
19 |
});
|
|
|
20 |
|
|
|
21 |
Y.Handlebars.registerHelper('image_url', function() {
|
|
|
22 |
var args = new Y.Array(arguments);
|
|
|
23 |
|
|
|
24 |
// Pop off the Handlebars object at the end.
|
|
|
25 |
args.pop();
|
|
|
26 |
|
|
|
27 |
// Perform the get_string.
|
|
|
28 |
return M.util.image_url.apply(this, args);
|
|
|
29 |
});
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
}, '@VERSION@');
|