templates_modules_graphsdir = $(templates_modulesdir)/graphs
dist_templates_modules_graphs_DATA = \
- src/templates/modules/graphs/box.html \
- src/templates/modules/graphs/preview.html \
- src/templates/modules/graphs/thumbnail.html \
- src/templates/modules/graphs/thumbnail-bar.html
+ src/templates/modules/graphs/box.html
templates_modules_menudir = $(templates_modulesdir)/menu
.top-bar {
margin-bottom: 1rem;
}
+
+img.graph {
+ margin-bottom: 1rem;
+}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block main %}
- {% module GraphBox(graph) %}
-{% end block %}
{% block main %}
{% for g in graphs %}
- {% module GraphBoxPreview(g) %}
+ {% module GraphBox(g) %}
{% end %}
{% end block %}
-<div class="page-header">
- <h3>{{ graph.title }}</h3>
-</div>
+{% set intervals = {
+ "hour" : _("Hour"),
+ "day" : _("Day"),
+ "week" : _("Week"),
+ "month" : _("Month"),
+ "year" : _("Year")
+} %}
-<img class="img-responsive img-thumbnail" src="{{ graph.make_image_url(width="1130") }}"
- alt="{{ graph.title }}">
+<h3>{{ graph.title }}</h3>
-<ul class="nav nav-pills">
- {% for interval in ("hour", "day", "week", "month", "year") %}
- <li {% if graph.interval == interval %}class="active"{% end %}>
- <a href="{{ graph.make_url(interval=interval) }}">
- {% if interval == "hour" %}
- {{ _("Hour") }}
- {% elif interval == "day" %}
- {{ _("Day") }}
- {% elif interval == "week" %}
- {{ _("Week") }}
- {% elif interval == "month" %}
- {{ _("Month") }}
- {% elif interval == "year" %}
- {{ _("Year") }}
- {% else %}
- {{ interval }}
- {% end %}
- </a>
+<ul class="tabs" data-tabs id="graph-tabs">
+ {% for i, interval in enumerate(intervals) %}
+ <li class="tabs-title {% if i == 0 %}is-active{% end %}">
+ <a href="#{{ interval }}" aria-selected="true">{{ intervals[interval] }}</a>
</li>
{% end %}
</ul>
-<a class="btn btn-default btn-sm" href="{{ graph.make_image_url(format="pdf") }}">
- {{ _("Download") }}
-</a>
+<div class="tabs-content" data-tabs-content="graph-tabs">
+ {% for i, interval in enumerate(intervals) %}
+ <div class="tabs-panel {% if i == 0 %}is-active{% end %}" id="{{ interval }}">
+ <img class="graph" src="{{ graph.make_image_url(interval=interval) }}"
+ alt="{{ graph.title }}">
+
+ <a class="button small expanded" href="{{ graph.make_image_url(interval=interval, format="pdf") }}">
+ {{ _("Download") }}
+ </a>
+ </div>
+ {% end %}
+</div>
+++ /dev/null
-<div class="page-header">
- <h3>
- <a href="{{ graph.make_url() }}">{{ graph.title }}</a>
- </h3>
-</div>
-
-{% module GraphThumbnailBar(graph) %}
-
-<a href="{{ graph.make_url(interval="week") }}">
- <img class="img-responsive img-thumbnail" src="{{ graph.make_image_url() }}"
- alt="{{ graph.title }}">
-</a>
+++ /dev/null
-<div class="row">
- {% for interval in ("1h", "12h", "1d", "week", "month", "year") %}
- <div class="col-md-2">
- {% module GraphThumbnail(graph, interval=interval) %}
- </div>
- {% end %}
-</div>
+++ /dev/null
-<img class="img-responsive img-thumbnail"
- src="{{ graph.make_thumbnail_url(**args) }}" alt="{{ graph.title }}">
class GraphBoxModule(base.BaseUIModule):
def render(self, graph):
return self.render_string("modules/graphs/box.html", graph=graph)
-
-
-class GraphBoxPreviewModule(base.BaseUIModule):
- def render(self, graph):
- return self.render_string("modules/graphs/preview.html", graph=graph)
-
-
-class GraphThumbnailModule(base.BaseUIModule):
- def render(self, graph, **kwargs):
- return self.render_string("modules/graphs/thumbnail.html", graph=graph, args=kwargs)
-
-
-class GraphThumbnailBarModule(base.BaseUIModule):
- def render(self, graph):
- return self.render_string("modules/graphs/thumbnail-bar.html", graph=graph)