Skip to content

Commit

Permalink
Open data zeroclick spice
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Nov 28, 2014
1 parent 425ab94 commit adc31d2
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/DDG/Spice/OpenData.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package DDG::Spice::OpenData;
# ABSTRACT: Returns information on datasets with published open data certificates

use DDG::Spice;

triggers any => 'open data';

spice to => 'https://certificates.theodi.org/datasets.json?search=$1';
spice wrap_jsonp_callback => 1;

handle remainder => sub {
return $_ if $_;
return;
};

1;
1 change: 1 addition & 0 deletions share/spice/open_data/footer.handlebars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{dataset.published_on}}
24 changes: 24 additions & 0 deletions share/spice/open_data/open_data.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.tile--open_data .tile__icon {
float: right;
margin-top: 0;
margin-right: 0;
}

.tile--open_data .tile__body {
height: 13em;
}

.tile--open_data .tile__content {
height: 6em;
}

.is-mobile .tile--open_data .tile__content {
height: 6.8em;
}

.tile--open_data .tile__footer {
height: auto;
margin-bottom: 0;
color: #aaa;
line-height: 1em;
}
37 changes: 37 additions & 0 deletions share/spice/open_data/open_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
(function (env) {
"use strict";
env.ddg_spice_open_data = function(api_result){

if (api_result.error) {
return Spice.failed('open_data');
}

Spice.add({
id: 'open_data',
name: 'Open Data',
data: api_result.certificates,
signal: 'high',
meta: {
itemType: 'Datasets',
sourceUrl: 'http://certificates.theodi.org',
sourceName: 'ODI Open Data Certificates'
},
normalize: function(item) {
return {
description: item.dataset.publisher,
url: item.dataset.documentationUrl,
icon: item.badges["image/png"],
title: item.dataset.title,
};
},
templates: {
group: 'icon',
detail: false,
item_detail: false,
options: {
footer: Spice.open_data.footer
}
}
});
};
}(this));

0 comments on commit adc31d2

Please sign in to comment.