Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@johnmartin
Created October 23, 2012 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnmartin/3937913 to your computer and use it in GitHub Desktop.
Save johnmartin/3937913 to your computer and use it in GitHub Desktop.
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