opendata-swiss / ckan-embed Goto Github PK
View Code? Open in Web Editor NEWJavaScript widget for embedding CKAN searches on other websites
Home Page: http://handbook.opendata.swiss/library/embed.html
License: MIT License
JavaScript widget for embedding CKAN searches on other websites
Home Page: http://handbook.opendata.swiss/library/embed.html
License: MIT License
Currently no images are displayed in the embedding plugin. This could include the logo of the portal, license icons, and institution images - these have all been requested by users. I don't yet know if there's a standard way to extract this from CKAN.
Currently the list of datasets output is by default roughly equivalent to the way it is presented in the portal. A user of the embed plugin in the OpenGLAM community asks:
Wouldn’t it be better to indicate the data providing institution instead of the thematic area in the list of datasets pulled from opendata.swiss? Also, I would suggest sorting the datasets on the institution name.
While it is now possible to use a template to change the output formatting, custom sorting requires an additional option in the plugin.
For this project to truly be a CKAN extension, there needs to be a way to install it into the CKAN platform, enabling the widget code to be accessible from somewhere in the administrative UI. Details on how this is done can be found at https://docs.ckan.org/en/2.8/extensions/tutorial.html
Some CKAN portals like opendata.swiss are multilingual, and if you want to target a specific language, I've added a wiki page explaining how to do that. However, if you want that users can switch languages interactively, or even combine results from multiple languages, it might be worth thinking about an explicit option in the widget. For this, I would need to dig into the way language support has evolved over the last couple of years, and if there's a standard way to select languages in the API.
Currently the widget just shows links to the source portal, where users need to navigate themselves to a download or preview. We could at least suggest how a direct download button could be embedded in the template - or a preview potentially integrated using Recline or similar.
Design and implement the ability to embed datasets or even search results in the form of an image, performing the output rendering server side. An SVG is probably the easier format, with a library like SVG.js or Python's svgwrite. This will make more sense in a dedicated project if we cannot reuse the code here.
A sketch of three possible views (full size/ popup mode, badge, sparkline) has been made at https://wireframe.cc/d7Ipo6
Justification: several potential users have been blocked from implementing this widget by CMS restrictions. Plus, it is clear that for some sites the external scripts - even when CDN'ed - pose a potential performance or security risk. And IFRAMEs are less desirable for accessibility reasons.
Currently the Webpack bundle is over 500 KB. Look into https://webpack.js.org/concepts/ and some possibly helpful advice here and here to see how we can improve things. Consider alternative frameworks like Zepto instead of jQuery and Lodash instead of Underscore.
While the current widget is relatively easy to get started it, the idea of having to put div
tags and other HTML somewhere in their content is rather daunting for users. I have been thinking that a better way to go would be to just include the script in the CMS, and then pick up plain search links in the page content as targets for the widget. Perhaps they would need to be suffixed with #ckanembed
or so, but this would dramatically improve the user experience. And it would truly take advantage of having an in-line widget, rather than the safer alternative of an IFRAME
or so. We could also then consider creating an additional mode for decorating links to specific datasets (e.g. on hover).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.