Skip to content

Commit

Permalink
Merge branch '2733-feature-datastore' of https://github.com/okfn/ckan
Browse files Browse the repository at this point in the history
…into 2733-feature-datastore
  • Loading branch information
domoritz committed Aug 29, 2012
2 parents 8909da9 + 95c9752 commit 0b279e9
Show file tree
Hide file tree
Showing 2 changed files with 745 additions and 414 deletions.
13 changes: 8 additions & 5 deletions ckan/public/scripts/application.js
Expand Up @@ -1669,8 +1669,8 @@ CKAN.DataPreview = function ($, my) {
}

// 4 situations
// a) webstore_url is active (something was posted to the datastore)
// b) csv or xls (but not webstore)
// a) something was posted to the datastore - need to check for this
// b) csv or xls (but not datastore)
// c) can be treated as plain text
// d) none of the above but worth iframing (assumption is
// that if we got here (i.e. preview shown) worth doing
Expand All @@ -1688,9 +1688,12 @@ CKAN.DataPreview = function ($, my) {
}
}

if (resourceData.webstore_url) {
resourceData.url = '/api/data/' + resourceData.id;
resourceData.backend = 'elasticsearch';
// Set recline CKAN backend API endpoint to right location (so it can locate
// CKAN DataStore)
recline.Backend.Ckan.API_ENDPOINT = CKAN.SITE_URL + '/api';

if (resourceData.datastore_active) {
resourceData.backend = 'ckan';
var dataset = new recline.Model.Dataset(resourceData);
var errorMsg = CKAN.Strings.errorLoadingPreview + ': ' + CKAN.Strings.errorDataStore;
dataset.fetch()
Expand Down

0 comments on commit 0b279e9

Please sign in to comment.