Skip to content

Commit

Permalink
Getting rid of the template heavy approach
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Dec 21, 2015
1 parent 458703d commit fffb0a7
Show file tree
Hide file tree
Showing 14 changed files with 2 additions and 113 deletions.
13 changes: 1 addition & 12 deletions panoramix/templates/panoramix/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
<style id="user_style" type="text/css">
{{ dashboard.css }}
</style>
{% for slice in dashboard.slices %}
{% set viz = slice.viz %}
{% import viz.template as viz_macros %}
{{ viz_macros.viz_css(viz) }}
{% endfor %}
{% endblock %}

{% block content_fluid %}
Expand Down Expand Up @@ -77,7 +72,6 @@ <h2>
{% for slice in dashboard.slices %}
{% set pos = pos_dict.get(slice.id, {}) %}
{% set viz = slice.viz %}
{% import viz.template as viz_macros %}
<li
id="slice_{{ slice.id }}"
slice_id="{{ slice.id }}"
Expand Down Expand Up @@ -111,7 +105,7 @@ <h2>
</table>
<div id="{{ viz.token }}" class="token" style="height: 100%;">
<img src="{{ url_for("static", filename="img/loading.gif") }}" class="loading" alt="loading">
<div class="slice_container" id="{{ viz.token }}_con" style="height: 100%; width: 100%;">{{ viz_macros.viz_html(viz) }}</div>
<div class="slice_container" id="{{ viz.token }}_con" style="height: 100%; width: 100%;"></div>
</div>
</li>
{% endfor %}
Expand All @@ -132,9 +126,4 @@ <h2>
var dashboard = px.Dashboard();
});
</script>
{% for slice in dashboard.slices %}
{% set viz = slice.viz %}
{% import viz.template as viz_macros %}
{{ viz_macros.viz_js(viz) }}
{% endfor %}
{% endblock %}
2 changes: 1 addition & 1 deletion panoramix/templates/panoramix/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
<div class="alert alert-warning">{{ viz.warning_msg }}</div>
{% endif %}
{% endblock %}
<div id="{{ viz.token }}_con" class="slice_container" style="height: 100%; width: 100%">{{ viz_macros.viz_html(viz) }}</div>
<div id="{{ viz.token }}_con" class="slice_container" style="height: 100%; width: 100%"></div>
</div>
</div>
</div>
Expand Down
8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{% import viz.template as viz_macros %}

{% if viz.form_data.get("json") == "true" %}
{{ viz.get_json() }}
{% else %}
Expand All @@ -10,18 +8,13 @@
{% endif %}


{% block viz_html %}
{{ viz_macros.viz_html(viz) }}
{% endblock %}

{% block head_css %}
{{super()}}
{% if viz.request.args.get("skip_libs") != "true" %}
{% for css in viz.css_files %}
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename=css) }}">
{% endfor %}
{% endif %}
{{ viz_macros.viz_css(viz) }}
{% endblock %}


Expand All @@ -31,7 +24,6 @@
{% for js in viz.js_files %}
<script src="{{ url_for('static', filename=js) }}"></script>
{% endfor %}
{{ viz_macros.viz_js(viz) }}
{% endif %}
{% endblock %}
{% endif %}
8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_bignumber.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_directed_force.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_markup.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_nvd3.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_pivot_table.html

This file was deleted.

9 changes: 0 additions & 9 deletions panoramix/templates/panoramix/viz_sankey.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_sunburst.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_table.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_word_cloud.html

This file was deleted.

8 changes: 0 additions & 8 deletions panoramix/templates/panoramix/viz_world_map.html

This file was deleted.

11 changes: 0 additions & 11 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
class BaseViz(object):
viz_type = None
verbose_name = "Base Viz"
template = None
is_timeseries = False
fieldsets = (
{
Expand Down Expand Up @@ -240,7 +239,6 @@ def json_data(self):
class TableViz(BaseViz):
viz_type = "table"
verbose_name = "Table View"
template = 'panoramix/viz_table.html'
fieldsets = (
{
'label': None,
Expand Down Expand Up @@ -307,7 +305,6 @@ def get_json_data(self):
class PivotTableViz(BaseViz):
viz_type = "pivot_table"
verbose_name = "Pivot Table"
template = 'panoramix/viz_pivot_table.html'
css_files = [
'lib/dataTables/dataTables.bootstrap.css',
'widgets/viz_pivot_table.css']
Expand Down Expand Up @@ -378,7 +375,6 @@ def get_json_data(self):
class MarkupViz(BaseViz):
viz_type = "markup"
verbose_name = "Markup Widget"
template = 'panoramix/viz_markup.html'
js_files = ['widgets/viz_markup.js']
fieldsets = (
{
Expand Down Expand Up @@ -406,7 +402,6 @@ class WordCloudViz(BaseViz):
"""
viz_type = "word_cloud"
verbose_name = "Word Cloud"
template = 'panoramix/viz_word_cloud.html'
is_timeseries = False
fieldsets = (
{
Expand Down Expand Up @@ -443,7 +438,6 @@ def get_json_data(self):
class NVD3Viz(BaseViz):
viz_type = None
verbose_name = "Base NVD3 Viz"
template = 'panoramix/viz_nvd3.html'
is_timeseries = False
js_files = [
'lib/d3.min.js',
Expand Down Expand Up @@ -525,7 +519,6 @@ def get_json_data(self):
class BigNumberViz(BaseViz):
viz_type = "big_number"
verbose_name = "Big Number"
template = 'panoramix/viz_bignumber.html'
is_timeseries = True
js_files = [
'lib/d3.min.js',
Expand Down Expand Up @@ -858,7 +851,6 @@ class SunburstViz(BaseViz):
viz_type = "sunburst"
verbose_name = "Sunburst"
is_timeseries = False
template = 'panoramix/viz_sunburst.html'
js_files = [
'lib/d3.min.js',
'widgets/viz_sunburst.js']
Expand Down Expand Up @@ -925,7 +917,6 @@ class SankeyViz(BaseViz):
viz_type = "sankey"
verbose_name = "Sankey"
is_timeseries = False
template = 'panoramix/viz_sankey.html'
js_files = [
'lib/d3.min.js',
'lib/d3-sankey.js',
Expand Down Expand Up @@ -968,7 +959,6 @@ class DirectedForceViz(BaseViz):
viz_type = "directed_force"
verbose_name = "Directed Force Layout"
is_timeseries = False
template = 'panoramix/viz_directed_force.html'
js_files = [
'lib/d3.min.js',
'widgets/viz_directed_force.js']
Expand Down Expand Up @@ -1015,7 +1005,6 @@ class WorldMapViz(BaseViz):
viz_type = "world_map"
verbose_name = "World Map"
is_timeseries = False
template = 'panoramix/viz_world_map.html'
js_files = [
'lib/d3.min.js',
'lib/topojson.min.js',
Expand Down

0 comments on commit fffb0a7

Please sign in to comment.