Fix modal charts

Fixes: bug #1212140

Change-Id: I6431cd0fc240ef9916c84e706403ed3f85767e06
This commit is contained in:
Imre Farkas 2013-08-20 16:09:25 +02:00
parent ecb7598bf9
commit 6f9dd13c16
6 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,6 @@
var Tuskar = function () {
var tuskar = {};
return tuskar;
};
var tuskar = new Tuskar();

View File

@ -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();
});

View File

@ -0,0 +1,19 @@
{% extends "horizon/client_side/template.html" %}
{% load horizon %}
{% block id %}modal_chart_template{% endblock %}
{% block template %}
{% jstemplate %}
<div class="[[classes]]" style="top: 80px; display: block;">
<ul id="interval_selector">
<li><a href="#" data-interval="12h">12h</a></li>
<li><a href="#" data-interval="24h">24h</a></li>
<li class="active"><a href="#" data-interval="1w">1w</a></li>
<li><a href="#" data-interval="1m">1m</a></li>
<li><a href="#" data-interval="1y">1y</a></li>
</ul>
<div id="modal_chart"></div>
</div>
{% endjstemplate %}
{% endblock %}

View File

@ -0,0 +1 @@
{% include "client_side/_modal_chart.html" %}

View File

@ -1,7 +1,11 @@
{% extends 'horizon/_scripts.html' %}
{% block custom_js_files %}
<script src='{{ STATIC_URL }}infrastructure/js/horizon.capacity.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}infrastructure/js/horizon.d3circleschart.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}infrastructure/js/horizon.d3linechart.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}infrastructure/js/horizon.d3singlebarchart.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}infrastructure/js/tuskar.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}infrastructure/js/tuskar.templates.js' type='text/javascript' charset='utf-8'></script>
{% endblock %}
{% comment %} Tuskar-UI Client-side Templates (These should *not* be inside the "compress" tag.) {% endcomment %}
{% include "client_side/templates.html" %}

View File

@ -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 %}