[1280] Change use of group.get_groups() to group.get_parent_groups()
--- a/ckanext/ga_report/ga_model.py
+++ b/ckanext/ga_report/ga_model.py
@@ -327,7 +327,7 @@
filter(model.Group.state=='active').all()
for publisher in publishers:
views, visits, subpub = update_publisher(period_name, publisher, publisher.name)
- parent, parents = '', publisher.get_groups('organization')
+ parent, parents = '', publisher.get_parent_groups(type='organization')
if parents:
parent = parents[0].name
item = model.Session.query(GA_Publisher).\
--- a/ckanext/ga_report/public/scripts/ckanext_ga_reports.js
+++ b/ckanext/ga_report/public/scripts/ckanext_ga_reports.js
@@ -97,7 +97,7 @@
* Show the correct rickshaw graph in the sidebar.
* Not to be called before all graphs load.
*/
- $('a[data-toggle="hashtab"]').on(
+ $('a[data-toggle="tab"]').on(
'shown',
function(e) {
var href = $(e.target).attr('href');
@@ -115,7 +115,7 @@
}
);
/* The first tab might already have been shown */
- $('li.active > a[data-toggle="hashtab"]').trigger('shown');
+ $('li.active > a[data-toggle="tab"]').trigger('shown');
};
CKAN.GA_Reports.bind_month_selector = function() {
--- a/ckanext/ga_report/templates/ga_report/publisher/read.html
+++ b/ckanext/ga_report/templates/ga_report/publisher/read.html
@@ -36,7 +36,10 @@
<py:with vars="download_link=h.url_for(controller='ckanext.ga_report.controller:GaDatasetReport',action='dataset_csv',id=c.publisher_name or 'all',month=c.month or 'all')">
<a class="btn button btn-primary btn-sm pull-right" href="${download_link}"><i class="icon-download"></i> Download as CSV</a>
</py:with>
- <h1>Site Usage</h1>
+ <h1>Site Usage
+ <small py:if="c.publisher">${c.publisher.title}</small>
+ <small py:if="not c.publisher">All datasets</small>
+ </h1>
<div class="row" style="background: #fff;">
<div class="col-md-4">
@@ -49,8 +52,6 @@
</div>
<div class="col-md-8">
<div class="whitebox">
- <strong py:if="c.publisher">Datasets From <a href="${h.url_for(controller='ckanext.dgu.controllers.publisher:PublisherController',action='read',id=c.publisher.name)}">${c.publisher.title}</a></strong>
- <strong py:if="not c.publisher">All Datasets</strong>
<py:if test="c.graph_data">
${rickshaw_graph(c.graph_data,'dataset-downloads',debug=True)}
</py:if>
--- a/ckanext/ga_report/templates/ga_report/site/index.html
+++ b/ckanext/ga_report/templates/ga_report/site/index.html
@@ -58,33 +58,33 @@
<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="active"><a href="#totals" data-hash="totals" data-toggle="tab">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>
+ <li><a href="#browsers_names" data-hash="browsers_names" data-toggle="tab">Browsers</a></li>
+ <li><a href="#browsers_versions" data-hash="browsers_versions" data-toggle="tab">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>
+ <li><a href="#os" data-hash="os" data-toggle="tab">Operating Systems</a></li>
+ <li><a href="#os_versions" data-hash="os_versions" data-toggle="tab">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>
+ <li><a href="#social_networks" data-hash="social_networks" data-toggle="tab">All networks</a></li>
+ <li><a href="#social_referrals_totals" data-hash="social_referrals_totals" data-toggle="tab">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>
+ <li><a href="#languages" data-hash="languages" data-toggle="tab">Languages</a></li>
+ <li><a href="#country" data-hash="country" data-toggle="tab">Country</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="totals">