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