Skip to content

Commit

Permalink
[#2278,master][s]: very minor tweak to new resource js code so that D…
Browse files Browse the repository at this point in the history
…ataStore is enabled by default for file and file.upload resource types - fixes #2278.
  • Loading branch information
rufuspollock committed Apr 3, 2012
1 parent 63144aa commit b7b3282
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ckan/public/scripts/application.js
Expand Up @@ -799,6 +799,7 @@ CKAN.View.ResourceAddUpload = Backbone.View.extend({
, hash: data._checksum
, cache_url: data._location
, cache_url_updated: lastmod
, webstore_url: data._location
}
, {
error: function(model, error) {
Expand Down Expand Up @@ -865,6 +866,7 @@ CKAN.View.ResourceAddUrl = Backbone.View.extend({
size: data.size,
mimetype: data.mimetype,
last_modified: data.last_modified,
webstore_url: 'enabled',
url_error: (data.url_errors || [""])[0]
});
self.collection.add(newResource);
Expand All @@ -874,6 +876,9 @@ CKAN.View.ResourceAddUrl = Backbone.View.extend({
}
else {
newResource.set({url: urlVal, resource_type: this.options.mode});
if (newResource.get('resource_type')=='file') {
newResource.set({webstore_url: 'enabled'});
}
this.collection.add(newResource);
this.resetForm();
}
Expand Down
4 changes: 2 additions & 2 deletions ckan/public/scripts/templates.js
Expand Up @@ -89,13 +89,13 @@ CKAN.Templates.resourceDetails = ' \
{{/if}} \
</div> \
</div> \
<div class="control-group"> \
<div class="control-group datastore-enabled"> \
<label for="" class="control-label" property="rdfs:label">'+CKAN.Strings.datastoreEnabled+'</label> \
<div class="controls"> \
<label class="checkbox"> \
<input type="checkbox" class="js-datastore-enabled-checkbox" /> \
<input type="hidden" name="resources__${num}__webstore_url" value="${resource.webstore_url}" class="js-datastore-enabled-text" /> \
<span class="hint">Should a <a href="http://docs.ckan.org/en/latest/storage/datastore.html" target="_blank">DataStore table and Data API</a> be enabled for this resource?</span> \
<span class="hint">Should a <a href="http://docs.ckan.org/en/latest/datastore.html" target="_blank">DataStore table and Data API</a> be enabled for this resource?</span> \
</label> \
</div> \
</div> \
Expand Down

0 comments on commit b7b3282

Please sign in to comment.