Skip to content

Commit

Permalink
[js,dataset/edit][s]: drop down for resource types as per the ticket …
Browse files Browse the repository at this point in the history
…(+ image option).
  • Loading branch information
rufuspollock committed Feb 2, 2012
1 parent a22624f commit 1670430
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 10 additions & 1 deletion ckan/public/scripts/application.js
Expand Up @@ -580,7 +580,16 @@ CKAN.View.ResourceEditList = Backbone.View.extend({
$tr.html($.tmpl(
CKAN.Templates.resourceEntry,
{ resource: resource.toTemplateJSON(),
num: position
num: position,
resourceTypeOptions: [
['file', 'Data File']
, ['api', 'API']
, ['image', 'Image']
, ['metadata', 'Metadata']
, ['documentation', 'Documentation']
, ['code', 'Code']
, ['example', 'Example']
]
}
));
$tr.find('.js-resource-edit-expanded').hide();
Expand Down
8 changes: 6 additions & 2 deletions ckan/public/scripts/templates.js
Expand Up @@ -102,11 +102,15 @@ CKAN.Templates.resourceEntry = ' \
<td class="resource-edit-label">'+CKAN.Strings.resourceType+'</td> \
<td class="resource-edit-value"> \
{{if resource.resource_type=="file.upload"}} \
${resource.resource_type} \
Data File (Uploaded) \
<input name="resources__${num}__resource_type" type="hidden" value="${resource.resource_type}" /> \
{{/if}} \
{{if resource.resource_type!="file.upload"}} \
<input name="resources__${num}__resource_type" type="text" value="${resource.resource_type}" /> \
<select name="resources__${num}__resource_type" class="short"> \
{{each resourceTypeOptions}} \
<option value="${$value[0]}" {{if $value[0]==resource.resource_type}}selected="selected"{{/if}}>${$value[1]}</option> \
{{/each}} \
</select> \
{{/if}} \
</td> \
</tr> \
Expand Down

0 comments on commit 1670430

Please sign in to comment.