Moved minor nav into util file and implemented
[ckanext-ga-report.git] / ckanext / ga_report / templates / ga_report / ga_util.html
blob:a/ckanext/ga_report/templates/ga_report/ga_util.html -> blob:b/ckanext/ga_report/templates/ga_report/ga_util.html
<html <html
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:i18n="http://genshi.edgewall.org/i18n" xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:py="http://genshi.edgewall.org/" xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xi="http://www.w3.org/2001/XInclude"
py:strip="" py:strip=""
> >
   
<table py:def="publisher_list(groups)" class="groups"> <select name="month" py:def="month_selector(current_month, months, day)">
<py:for each="group,title in groups"> <option value='' py:attrs="{'selected': 'selected' if not current_month else None}">All months</option>
<tr> <py:for each="i, (val,desc) in enumerate(months)">
<td><a href="/publisher/${group.name}">${title}</a></td> <option value='${val}' py:attrs="{'selected': 'selected' if current_month == val else None}">${desc}<py:if test="i == 0 and day"> (up to ${day})</py:if></option>
</tr> </py:for>
</py:for> </select>
   
   
  <table py:def="social_table(items, with_source=False)" class="ga-reports-table table table-condensed table-bordered table-striped">
  <tr>
  <th>Name</th>
  <th py:if="with_source">Source</th>
  <th>Visits</th>
  </tr>
  <py:for each="name, url, source, count in items">
  <tr>
  <td><a href="${url}">${name}</a></td>
  <td py:if="with_source">${source}</td>
  <td class="td-numeric">${count}</td>
  </tr>
  </py:for>
</table> </table>
   
   
<div py:def="usage_nav(active_name,publisher)" id="minornavigation"> <div py:def="rickshaw_graph(items_json,id,mode='line',colorscheme='munin')">
<div id="minornavigation-bg-left"> <div id="chart_container_$id" class="rickshaw_chart_container">
<div id="minornavigation-bg-right"> <div id="y_axis_$id" class="rickshaw_y_axis"></div>
<ul class="nav nav-pills"> <div id="chart_$id" class="rickshaw_chart"></div>
<li py:attrs="{'class': 'active' if active_name=='Site-wide' else None}"><a py:attrs="{'class': 'active' if active_name=='Site-wide' else None}" href="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}"><img src="/images/icons/page_white_gear.png" height="16px" width="16px" alt="None" class="inline-icon "/> Site-wide</a></li> <script type="text/javascript">
<li py:attrs="{'class': 'active' if active_name=='Publishers' else None}"> $(function() {
<a py:attrs="{'class': 'active' if active_name=='Publishers' else None}" href="${h.url_for(controller='ckanext.ga_report.controller:GaPublisherReport',action='index')}"><img src="/images/icons/page_white_gear.png" height="16px" width="16px" alt="None" class="inline-icon "/> Publishers</a> var items = $items_json;
</li> if (items.length==0) { return; }
<li py:if="publisher" class="active"> CKAN.GA_Reports.render_rickshaw('$id', items, '$mode', '$colorscheme');
<a class="active" href="${h.url_for(controller='ckanext.ga_report.controller:GaPublisherReport',action='read', id=publisher.name)}"><img src="/images/icons/page_white_gear.png" height="16px" width="16px" alt="None" class="inline-icon "/>${publisher.title}</a> });
</li> </script>
  </div>
  </div>
   
</ul>  
</div> <table py:def="stat_table(items, title='Views')" class="ga-reports-table table table-condensed table-bordered table-striped">
</div> <tr>
  <th>Name</th>
  <th class="td-numeric">% ${title}</th>
  </tr>
  <py:for each="name, value in items">
  <tr>
  <td>${name}</td>
  <td class="td-numeric">${value}</td>
  </tr>
  </py:for>
  </table>
   
   
  <div py:def="usage_nav(active_name)">
  <span class="subheading">
  <img src="/images/arrow-down-right.png" />
  <a class="${if_(active_name=='Site-wide','active')}" href="${h.url_for(controller='ckanext.ga_report.controller:GaReport',action='index')}${if_(c.month,'?month='+c.month)}">Site-wide</a>
  <span class="divider">|</span>
  <a class="${if_(active_name=='Publishers','active')}" href="${h.url_for(controller='ckanext.ga_report.controller:GaDatasetReport',action='publishers')}${if_(c.month,'?month='+c.month)}">Publishers</a>
  <span class="divider">|</span>
  <a class="${if_(active_name=='Datasets','active')}" href="${h.url_for(controller='ckanext.ga_report.controller:GaDatasetReport',action='read')}${if_(c.month,'?month='+c.month)}">Datasets</a>
  </span>
</div> </div>
   
   
</html> </html>