Skip to content

Commit

Permalink
Merge branch 'main' into fix-string-escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
FuhuXia authored Jun 21, 2024
2 parents 70a3b11 + d74ee48 commit ad50a91
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ckanext/datagovtheme/fanstatic_library/scripts/popular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions ckanext/datagovtheme/fanstatic_library/webassets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ popular-js:
output: datagovtheme/popular.js
contents:
- scripts/popular.js
extra:
preload:
- vendor/jquery

0 comments on commit ad50a91

Please sign in to comment.