[903] Integrated 777 branch and updated to fit the new look.
[ckanext-ga-report.git] / ckanext / ga_report / templates / ga_report / site / index.html
blob:a/ckanext/ga_report/templates/ga_report/site/index.html -> blob:b/ckanext/ga_report/templates/ga_report/site/index.html
--- a/ckanext/ga_report/templates/ga_report/site/index.html
+++ b/ckanext/ga_report/templates/ga_report/site/index.html
@@ -19,159 +19,184 @@
     <script type="text/javascript" src="/scripts/vendor/rickshaw.min.js"></script>
   </py:def>
 
-  <py:def function="sidebar">
-    ${ga_sidebar(download_link=h.url_for(controller='ckanext.ga_report.controller:GaReport',action='csv',month=c.month or 'all'))}
-  </py:def>
-
-
  <py:match path="breadcrumbs">
     <li><a href="/data/site-usage">Site Analytics</a></li>
     <li><a href="/data/site-usage">Site-wide</a></li>
   </py:match>
 
-
   <div py:match="content">
-
-    <h3 style='text-align:center;'>
-      Site-wide
-      <span style="color: #bbb;margin:10px;">|</span>
-      <a href="/data/site-usage/publisher">Publishers</a>
-      <span style="color: #bbb;margin:10px;">|</span>
-      <a href="/data/site-usage/dataset">Datasets</a>
-    </h3>
-
-    <div class="boxed">
-    <div class="tabbable">
-      <ul class="nav nav-tabs">
-        <li class="active"><a href="#totals" data-toggle="hashtab">Totals</a></li>
-        <li class="dropdown">
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Browsers
-                <b class="caret"></b></a>
-            <ul class="dropdown-menu">
-                <li><a href="#browsers_names" data-toggle="hashtab">Browsers</a></li>
-                <li><a href="#browsers_versions" data-toggle="hashtab">Versions</a></li>
+    <div class="row">
+      <div class="col-sm-7 col-md-8 col-lg-9">
+        <py:with vars="download_link=h.url_for(controller='ckanext.ga_report.controller:GaReport',action='csv',month=c.month or 'all')">
+          <a class="btn button btn-primary btn-sm pull-right" href="${download_link}"><i class="icon-download"></i>&nbsp; Download as CSV</a>
+        </py:with>
+        <h1>Site Usage</h1>
+      </div>
+      <div class="col-sm-5 col-md-4 col-lg-3">
+        <div class="panel panel-default">
+          <div class="panel-heading"><strong>Jump To...</strong></div>
+          <div class="panel-body">
+            <ul>
+              <li><a href="/data/site-usage/publisher">Publisher Usage Statistics</a></li>
+              <li><a href="/data/site-usage/dataset">Dataset Usage Statistics</a></li>
             </ul>
-        </li>
-        <li class="dropdown">
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Operating Systems
-                <b class="caret"></b></a>
-            <ul class="dropdown-menu">
-                <li><a href="#os" data-toggle="hashtab">Operating Systems</a></li>
-                <li><a href="#os_versions" data-toggle="hashtab">Versions</a></li>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div class="row" style="background: #fff;">
+      <div class="col-md-4">
+        <div class="whitebox">
+          <strong>Graph Legend</strong>
+          <div id="graph-legend-container">
+            <div style="display: none;" id="legend_none">(No graph is loaded)</div>
+          </div>
+        </div>
+      </div>
+      <div class="col-md-8">
+        <div class="whitebox">
+          <div class="tabbable">
+            <ul class="nav nav-tabs">
+              <li class="active"><a href="#totals" data-toggle="hashtab">Totals</a></li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Browsers
+                      <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="#browsers_names" data-toggle="hashtab">Browsers</a></li>
+                      <li><a href="#browsers_versions" data-toggle="hashtab">Versions</a></li>
+                  </ul>
+              </li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Operating Systems
+                      <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="#os" data-toggle="hashtab">Operating Systems</a></li>
+                      <li><a href="#os_versions" data-toggle="hashtab">Versions</a></li>
+                  </ul>
+              </li>
+              <li class="dropdown">
+                  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social
+                      <b class="caret"></b></a>
+                  <ul class="dropdown-menu">
+                      <li><a href="#social_networks" data-toggle="hashtab">All networks</a></li>
+                      <li><a href="#social_referrals_totals" data-toggle="hashtab">Referral links</a></li>
+                  </ul>
+              </li>
+              <li><a href="#languages" data-toggle="hashtab">Languages</a></li>
+              <li><a href="#country" data-toggle="hashtab">Country</a></li>
             </ul>
-        </li>
-        <li class="dropdown">
-            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Social
-                <b class="caret"></b></a>
-            <ul class="dropdown-menu">
-                <li><a href="#social_networks" data-toggle="hashtab">All networks</a></li>
-                <li><a href="#social_referrals_totals" data-toggle="hashtab">Referral links</a></li>
-            </ul>
-        </li>
-        <li><a href="#languages" data-toggle="hashtab">Languages</a></li>
-        <li><a href="#country" data-toggle="hashtab">Country</a></li>
-      </ul>
-      <div class="tab-content">
-        <div class="tab-pane active" id="totals">
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${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>
-            	   <th class="td-numeric">Value</th>
-            	   <th>History</th>
-            	 </tr>
-                <py:for each="name, value, graph in c.global_totals">
-                    <tr>
-                        <td>${name}</td>
-                        <td class="td-numeric">${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">
-             ${rickshaw_graph(c.browser_versions_graph,'browser-versions',mode='stack')}
-             <hr/>
-             <p>Note: Where a browser has a large number of versions, these have been grouped together.</p>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.browser_versions)}
-         </div>
-         <div class="tab-pane" id="browsers_names">
-             ${rickshaw_graph(c.browsers_graph,'browsers',mode='stack')}
-             <hr/>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.browsers)}
-         </div>
-         <div class="tab-pane" id="os">
-             ${rickshaw_graph(c.os_graph,'os',mode='stack')}
-             <hr/>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.os)}
-         </div>
-         <div class="tab-pane" id="os_versions">
-             ${rickshaw_graph(c.os_versions_graph,'os_versions',mode='stack')}
-             <hr/>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.os_versions)}
-         </div>
-        <div class="tab-pane" id="social_referrals_totals">
-            <p>Number of visits that were referred from social networks</p>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-            ${social_table(c.social_referrer_totals)}
-        </div>
-        <div class="tab-pane" id="social_networks">
-             ${rickshaw_graph(c.social_networks_graph, 'social_networks',mode='stack')}
-             <hr/>
-            <p>Percentage of visits that were referred from these social networks</p>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.social_networks, 'Visits')}
-        </div>
-        <div class="tab-pane" id="languages">
-             ${rickshaw_graph(c.languages_graph,'languages',mode='stack')}
-             <hr/>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.languages)}
-        </div>
-        <div class="tab-pane" id="country">
-             ${rickshaw_graph(c.country_graph,'country',mode='stack')}
-             <hr/>
-             <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
-               <h4 class="ga-reports-heading">Show stats table for:</h4>
-               ${month_selector(c.month, c.months, c.day)}
-             </form>
-             ${stat_table(c.country)}
-        </div>
+            <div class="tab-content">
+              <div class="tab-pane active" id="totals">
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${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>
+                       <th class="td-numeric">Value</th>
+                       <th>History</th>
+                     </tr>
+                      <py:for each="name, value, graph in c.global_totals">
+                          <tr>
+                              <td>${name}</td>
+                              <td class="td-numeric">${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">
+                   ${rickshaw_graph(c.browser_versions_graph,'browser-versions',mode='stack')}
+                   <hr/>
+                   <p>Note: Where a browser has a large number of versions, these have been grouped together.</p>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.browser_versions)}
+               </div>
+               <div class="tab-pane" id="browsers_names">
+                   ${rickshaw_graph(c.browsers_graph,'browsers',mode='stack')}
+                   <hr/>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.browsers)}
+               </div>
+               <div class="tab-pane" id="os">
+                   ${rickshaw_graph(c.os_graph,'os',mode='stack')}
+                   <hr/>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.os)}
+               </div>
+               <div class="tab-pane" id="os_versions">
+                   ${rickshaw_graph(c.os_versions_graph,'os_versions',mode='stack')}
+                   <hr/>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.os_versions)}
+               </div>
+              <div class="tab-pane" id="social_referrals_totals">
+                  <p>Number of visits that were referred from social networks</p>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                  ${social_table(c.social_referrer_totals)}
+              </div>
+              <div class="tab-pane" id="social_networks">
+                   ${rickshaw_graph(c.social_networks_graph, 'social_networks',mode='stack')}
+                   <hr/>
+                  <p>Percentage of visits that were referred from these social networks</p>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.social_networks, 'Visits')}
+              </div>
+              <div class="tab-pane" id="languages">
+                   ${rickshaw_graph(c.languages_graph,'languages',mode='stack')}
+                   <hr/>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.languages)}
+              </div>
+              <div class="tab-pane" id="country">
+                   ${rickshaw_graph(c.country_graph,'country',mode='stack')}
+                   <hr/>
+                   <form class="form-inline" action="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}" method="get">
+                     <h4 class="ga-reports-heading">Show stats table for:</h4>
+                     ${month_selector(c.month, c.months, c.day)}
+                   </form>
+                <hr/>
+                   ${stat_table(c.country)}
+              </div>
+             </div>
+           </div>
        </div>
-     </div>
-   </div>
+      </div>
+    </div>
+
   </div>