diff --git a/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.js b/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.js new file mode 100644 index 000000000..c9f29de63 --- /dev/null +++ b/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.js @@ -0,0 +1,6 @@ +var Tuskar = function () { + var tuskar = {}; + return tuskar; +}; + +var tuskar = new Tuskar(); diff --git a/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.templates.js b/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.templates.js new file mode 100644 index 000000000..5f8e68628 --- /dev/null +++ b/tuskar_ui/infrastructure/static/infrastructure/js/tuskar.templates.js @@ -0,0 +1,16 @@ +/* Namespace for core functionality related to client-side templating. */ +tuskar.templates = { + template_ids: ["#modal_chart_template"], +}; + +/* Pre-loads and compiles the client-side templates. */ +tuskar.templates.compile_templates = function () { + $.each(tuskar.templates.template_ids, function (ind, template_id) { + horizon.templates.compiled_templates[template_id] = Hogan.compile($(template_id).html()); + }); +}; + +horizon.addInitFunction(function () { + // Load client-side template fragments and compile them. + tuskar.templates.compile_templates(); +}); diff --git a/tuskar_ui/infrastructure/templates/client_side/_modal_chart.html b/tuskar_ui/infrastructure/templates/client_side/_modal_chart.html new file mode 100644 index 000000000..e26a7d4d9 --- /dev/null +++ b/tuskar_ui/infrastructure/templates/client_side/_modal_chart.html @@ -0,0 +1,19 @@ +{% extends "horizon/client_side/template.html" %} +{% load horizon %} + +{% block id %}modal_chart_template{% endblock %} + +{% block template %} +{% jstemplate %} +
+ + +
+{% endjstemplate %} +{% endblock %} diff --git a/tuskar_ui/infrastructure/templates/client_side/templates.html b/tuskar_ui/infrastructure/templates/client_side/templates.html new file mode 100644 index 000000000..c16465859 --- /dev/null +++ b/tuskar_ui/infrastructure/templates/client_side/templates.html @@ -0,0 +1 @@ +{% include "client_side/_modal_chart.html" %} diff --git a/tuskar_ui/infrastructure/templates/infrastructure/_scripts.html b/tuskar_ui/infrastructure/templates/infrastructure/_scripts.html index 44cc82b14..a3200f80a 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/_scripts.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/_scripts.html @@ -1,7 +1,11 @@ -{% extends 'horizon/_scripts.html' %} {% block custom_js_files %} + + {% endblock %} + +{% comment %} Tuskar-UI Client-side Templates (These should *not* be inside the "compress" tag.) {% endcomment %} +{% include "client_side/templates.html" %} \ No newline at end of file diff --git a/tuskar_ui/infrastructure/templates/infrastructure/base.html b/tuskar_ui/infrastructure/templates/infrastructure/base.html index 03d4a1660..bf46451fe 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/base.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/base.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block css %} - {% include "_stylesheets.html" %} + {{block.super}} {% load compress %} {% compress css %} @@ -10,5 +10,6 @@ {% endblock %} {% block js %} + {{ block.super }} {% include "infrastructure/_scripts.html" %} {% endblock %}