diff --git a/README.md b/README.md index dc8da916..032dc5af 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,9 @@ CKAN version | Compatibility `ckanext.datagovtheme.js_recent_view = true` -This defaults to `false`. If displaying the recent view count slows down page loading, the optional parameter can be set to `true` to make the recent view count an AJAX call, improving page loading speed. If the recent view count information (package['tracking_summary']) is already present, the AJAX call is disabled to reduce overhead. Therefore, the built-in recent view count rendering must be disabled for this mechanism to take effect. +This defaults to `false`. If displaying the recent view count slows down page loading, the optional parameter can be set to `true` to make the recent view count an AJAX call, improving page loading speed. If the recent view count information (package['tracking_summary']) is already present, the AJAX call is disabled to reduce overhead. Therefore, the built-in recent view count rendering must be disabled for this mechanism to take effect. For catalog.data.gov, it means set setting `ckanext.datagovcatalog.add_packages_tracking_info` to false. + +**TODO**: re-evaluate the need for this customization after ckan 2.11 release, as described in ticket https://github.com/GSA/data.gov/issues/4798. ## Development diff --git a/ckanext/datagovtheme/fanstatic_library/scripts/popular.js b/ckanext/datagovtheme/fanstatic_library/scripts/popular.js index 261244b5..b7483c78 100644 --- a/ckanext/datagovtheme/fanstatic_library/scripts/popular.js +++ b/ckanext/datagovtheme/fanstatic_library/scripts/popular.js @@ -3,12 +3,12 @@ jQuery(function ($) { // This api takes a list of package ids from querystring and returns the view count for each package - var pupolar_api = "/datagovtheme/get-popular-count"; + var popular_api = "/datagovtheme/get-popular-count"; // all ids in a string, comma separated var pkgs = {'pkgs': collect_all_packages().join(',')}; - $.getJSON(pupolar_api, pkgs, function(data) { + $.getJSON(popular_api, pkgs, function(data) { $.each( data, function( key, val ) { $("ul.dataset-list li.dataset-item h3.dataset-heading").each(function() { if ($(this).attr('pkg_id') == key) { diff --git a/ckanext/datagovtheme/fanstatic_library/webassets.yml b/ckanext/datagovtheme/fanstatic_library/webassets.yml index 783e9fd8..d0c6d26f 100644 --- a/ckanext/datagovtheme/fanstatic_library/webassets.yml +++ b/ckanext/datagovtheme/fanstatic_library/webassets.yml @@ -43,3 +43,6 @@ popular-js: output: datagovtheme/popular.js contents: - scripts/popular.js + extra: + preload: + - vendor/jquery