Skip to content

Commit

Permalink
Use selecting value datatype when adding resources
Browse files Browse the repository at this point in the history
  • Loading branch information
zerocrates committed May 24, 2022
1 parent 2a75228 commit ca8135a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions application/asset/js/resource-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@
var valueObj = $('.resource-details').data('resource-values');
var value = $('.selecting-resource');
if (value.hasClass('value')) {
$(document).trigger('o:prepare-value', ['resource', value, valueObj]);
var dataType = value.data('data-type');
$(document).trigger('o:prepare-value', [dataType, value, valueObj]);
} else if (value.hasClass('value-annotation')) {
const dataTypeName = value.find('input.data_type').val();
valueObj.type = dataTypeName;
Expand All @@ -288,15 +289,16 @@
$('#select-resource').on('o:resources-selected', '.select-resources-button', function(e) {
var value = $('.selecting-resource');
if (value.hasClass('value')) {
var dataType = value.data('data-type');
var field = value.closest('.resource-values.field');
$('#item-results').find('.resource')
.has('input.select-resource-checkbox:checked').each(function(index) {
if (0 < index) {
value = makeNewValue(field.data('property-term'), 'resource');
value = makeNewValue(field.data('property-term'), dataType);
field.find('.values').append(value);
}
var valueObj = $(this).data('resource-values');
$(document).trigger('o:prepare-value', ['resource', value, valueObj]);
$(document).trigger('o:prepare-value', [dataType, value, valueObj]);
});
} else if (value.hasClass('value-annotation')) {
const dataTypeName = value.find('input.data_type').val();
Expand Down

0 comments on commit ca8135a

Please sign in to comment.