SpeciesFileGroup/taxonworks

View on GitHub
app/views/data_attributes/api/v1/_attributes.json.jbuilder

Summary

Maintainability
Test Coverage
json.extract! data_attribute, :id, :type, :attribute_subject_id, :attribute_subject_type, :controlled_vocabulary_term_id, :import_predicate, :value,
:created_at, :updated_at, :created_by_id, :updated_by_id, :project_id
json.predicate_name data_attribute.predicate_name

json.partial! '/shared/data/all/metadata', object: data_attribute

if extend_response_with('annotated_object')
  json.annotated_object do
    json.partial! '/shared/data/all/metadata', object: metamorphosize_if(data_attribute.attribute_subject), extensions: false
  end
end

if extend_response_with('predicate')
  if data_attribute.editable?
    json.controlled_vocabulary_term do
      json.partial! '/controlled_vocabulary_terms/api/v1/attributes', controlled_vocabulary_term: data_attribute.predicate, extensions: false
    end
  end
end