[321] Added month selector. Colorising graphs in Safari and IE.
--- a/ckanext/ga_report/public/scripts/ckanext_ga_reports.js
+++ b/ckanext/ga_report/public/scripts/ckanext_ga_reports.js
@@ -55,24 +55,29 @@
* Sparkline graphs should be drawn.
* Note that they cannot be drawn sooner.
*/
+ var created = false;
$('a[href="#totals"]').on(
'shown',
- function() {
- var sparkOptions = {
- enableTagOptions: true,
- type: 'line',
- width: 100,
- height: 26,
- chartRangeMin: 0,
- spotColor: '',
- maxSpotColor: '',
- minSpotColor: '',
- highlightSpotColor: '000000',
- lineColor: '3F8E6D',
- fillColor: 'B7E66B'
- };
- $('.sparkline').sparkline('html',sparkOptions);
- }
+ function() {
+ if (!created) {
+ var sparkOptions = {
+ enableTagOptions: true,
+ type: 'line',
+ width: 100,
+ height: 26,
+ chartRangeMin: 0,
+ spotColor: '',
+ maxSpotColor: '',
+ minSpotColor: '',
+ highlightSpotColor: '#000000',
+ lineColor: '#3F8E6D',
+ fillColor: '#B7E66B'
+ };
+ $('.sparkline').sparkline('html',sparkOptions);
+ created = true;
+ }
+ $.sparkline_display_visible();
+ }
);
};
--- a/ckanext/ga_report/templates/ga_report/publisher/index.html
+++ b/ckanext/ga_report/templates/ga_report/publisher/index.html
@@ -24,8 +24,8 @@
<py:def function="optional_head">
<link rel="stylesheet" type="text/css" href="/scripts/vendor/rickshaw.min.css"/>
- <link rel="stylesheet" type="text/css" href="/css/ga_report.css"/>
- <script type="text/javascript" src="/scripts/ckanext_ga_reports.js"></script>
+ <link rel="stylesheet" type="text/css" href="/css/ga_report.css?1"/>
+ <script type="text/javascript" src="/scripts/ckanext_ga_reports.js?1"></script>
<script type="text/javascript" src="/scripts/vendor/jquery.sparkline.modified.js"></script>
<script type="text/javascript" src="/scripts/rickshaw_ie7_shim.js"></script>
<script type="text/javascript" src="/scripts/vendor/d3.v2.js"></script>
--- a/ckanext/ga_report/templates/ga_report/publisher/read.html
+++ b/ckanext/ga_report/templates/ga_report/publisher/read.html
@@ -9,8 +9,8 @@
<py:def function="optional_head">
<link rel="stylesheet" type="text/css" href="/scripts/vendor/rickshaw.min.css"/>
- <link rel="stylesheet" type="text/css" href="/css/ga_report.css"/>
- <script type="text/javascript" src="/scripts/ckanext_ga_reports.js"></script>
+ <link rel="stylesheet" type="text/css" href="/css/ga_report.css?1"/>
+ <script type="text/javascript" src="/scripts/ckanext_ga_reports.js?1"></script>
<script type="text/javascript" src="/scripts/vendor/jquery.sparkline.modified.js"></script>
<script type="text/javascript" src="/scripts/rickshaw_ie7_shim.js"></script>
<script type="text/javascript" src="/scripts/vendor/d3.v2.js"></script>
--- a/ckanext/ga_report/templates/ga_report/site/index.html
+++ b/ckanext/ga_report/templates/ga_report/site/index.html
@@ -9,8 +9,8 @@
<py:def function="optional_head">
<link rel="stylesheet" type="text/css" href="/scripts/vendor/rickshaw.min.css"/>
- <link rel="stylesheet" type="text/css" href="/css/ga_report.css"/>
- <script type="text/javascript" src="/scripts/ckanext_ga_reports.js"></script>
+ <link rel="stylesheet" type="text/css" href="/css/ga_report.css?1"/>
+ <script type="text/javascript" src="/scripts/ckanext_ga_reports.js?1"></script>
<script type="text/javascript" src="/scripts/vendor/jquery.sparkline.modified.js"></script>
<script type="text/javascript" src="/scripts/rickshaw_ie7_shim.js"></script>
<script type="text/javascript" src="/scripts/vendor/d3.v2.js"></script>
@@ -71,6 +71,10 @@
</ul>
<div class="tab-content">
<div class="tab-pane" id="totals">
+ <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+ <label>Show stats table for:</label>
+ ${month_selector(c.month, c.months, c.day)}
+ </form>
<table class="ga-reports-table table table-condensed table-bordered table-striped">
<tr>
<th>Name</th>