Created
October 23, 2012 09:39
-
-
Save johnmartin/3937913 to your computer and use it in GitHub Desktop.
Dataset list with popover examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
}); | |
} | |
} | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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