horizon/horizon/static/horizon/js/horizon.templates.js

19 lines
723 B
JavaScript

/* global Hogan */
/* Namespace for core functionality related to client-side templating. */
horizon.templates = {
template_ids: ["#modal_template", "#empty_row_template", "#alert_message_template", "#spinner-modal", "#membership_template"],
compiled_templates: {}
};
/* Pre-loads and compiles the client-side templates. */
horizon.templates.compile_templates = function () {
$.each(horizon.templates.template_ids, function (ind, template_id) {
horizon.templates.compiled_templates[template_id] = Hogan.compile($(template_id).html());
});
};
horizon.addInitFunction(horizon.templates.init = function () {
// Load client-side template fragments and compile them.
horizon.templates.compile_templates();
});