--- a/ckanext/ga_report/templates/ga_report/site/index.html +++ b/ckanext/ga_report/templates/ga_report/site/index.html @@ -7,36 +7,38 @@ <py:def function="page_title">Site usage</py:def> + <py:def function="optional_head"> + <script type="text/javascript" src="/scripts/vendor/jquery.sparkline.modified.js"></script> + <style type="text/css"> + .table-condensed td.sparkline-cell { + padding: 1px 0 0 0; + width: 108px; + text-align: center; + } + </style> + </py:def> + <py:match path="primarysidebar"> - <li class="widget-container boxed widget_text"> - <h4>Site-wide</h4> - <p> - Note: this data does not include API calls and some values have been rounded up to 2 decimal places. Where there are a large number of browser versions they have been grouped together. - </p> - </li> <li class="widget-container boxed widget_text"> <h4>Download</h4> <p><center> - <a class="btn button" href="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='csv',month=c.month or 'all')}">Download as CSV</a></center> + <a class="btn button btn-primary" href="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='csv',month=c.month or 'all')}">Download as CSV</a></center> </p> </li> + <xi:include href="../notes.html" /> </py:match> <div py:match="content"> <h1>Site Usage</h1> - ${usage_nav('Site-wide', None)} + ${usage_nav('Site-wide')} <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get"> <div class="controls"> - <select name="month"> - <option value='' py:attrs="{'selected': 'selected' if not c.month else None}">All time</option> - <py:for each="val,desc in c.months"> - <option value='${val}' py:attrs="{'selected': 'selected' if c.month == val else None}">${desc}</option> - </py:for> - </select> - <input class="btn button" type='submit' value="Update"/> + ${month_selector(c.month, c.months, c.day)} + + <input class="btn button btn-primary" type='submit' value="Update"/> </div> </form> @@ -78,16 +80,23 @@ <tr> <th>Name</th> <th>Value</th> + <th>History</th> </tr> - <py:for each="name, value in c.global_totals"> + <py:for each="name, value, graph in c.global_totals"> <tr> <td>${name}</td> <td>${value}</td> + <td class="sparkline-cell"> + <span class="sparkline" sparkTooltips="${','.join([x for x,y in graph])}"> + ${','.join([y for x,y in graph])} + </span> + </td> </tr> </py:for> </table> </div> <div class="tab-pane" id="browsers_versions"> + <p>Note: Where a browser has a large number of versions, these have been grouped together.</p> ${stat_table(c.browser_versions)} </div> <div class="tab-pane" id="browsers_names"> @@ -100,11 +109,11 @@ ${stat_table(c.os_versions)} </div> <div class="tab-pane" id="social_referrals_totals"> - <p>Number of visits to urls referred from social networks</p> + <p>Number of visits that were referred from social networks</p> ${social_table(c.social_referrer_totals)} </div> <div class="tab-pane" id="social_networks"> - <p>Percentage of visits referred from these social networks</p> + <p>Percentage of visits that were referred from these social networks</p> ${stat_table(c.social_networks, 'Visits')} </div> @@ -123,18 +132,29 @@ </div> - <xi:include href="../../layout.html" /> <py:def function="optional_footer"> - <script type='text/javascript'> - $('.dropdown-toggle').dropdown(); - $('.nav-tabs li a').click(function (e) { - e.preventDefault(); - $(this).tab('show'); - }) - alert(window.location.hash); + <script type="text/javascript"> + $(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); + }); </script> </py:def> + + <xi:include href="../../layout.html" /> </html>