Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dataset list with popover examples
<p>This is a list of <a href="#datasetgroup-1" data-module="popover-list">5 datasets</a>.
Imagine there is more text here and it carries on in a paragraph.</p>
<p id="datasetgroup-1" class="js-hide">Everything in this paragraph
should appear within the popover.</p>
// Location: ckan/public/base/javascript/modules/popover-list.js
this.ckan.module('popover-list', function (jQuery, _) {
return {
initialize: function () {
var id = this.el.prop('href').replace(/.+\#/, '');
var content = jQuery('#' + id).html();
if (content) {
this.el.popover({
title: this.el.text(),
content: content
});
}
}
};
});
// File: ckan/public/base/javascript/resource.config
// Add this to the end of the ckan definition:
modules/popover-list.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.