From 346afa4b83f88e2aeddc50c3ac14bbbe43ebf159 Mon Sep 17 00:00:00 2001 From: Fuhu Xia Date: Thu, 20 Jun 2024 11:56:19 -0400 Subject: [PATCH 1/2] typo and readme --- README.md | 4 +++- ckanext/datagovtheme/fanstatic_library/scripts/popular.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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) { From a5617dc58edb1fbdeed04f6188e523ef2755efd9 Mon Sep 17 00:00:00 2001 From: Fuhu Xia Date: Fri, 21 Jun 2024 08:44:26 -0400 Subject: [PATCH 2/2] load jquery before using it --- ckanext/datagovtheme/fanstatic_library/webassets.yml | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) 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 diff --git a/setup.py b/setup.py index f8048c64..1d894708 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ setup( name="ckanext-datagovtheme", - version="0.2.25", + version="0.2.26", description="CKAN Extension to manage data.gov theme", long_description=long_description, classifiers=[