Skip to content

Commit

Permalink
Always show all fields in record detail view (close #229)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Dec 9, 2024
1 parent 6bfd25c commit 69b1e73
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions frontend/vre/field/field.model.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import Backbone from 'backbone';
import { canonicalSort } from '../utils/generic-functions';
import {fieldList, properties} from "../utils/record-ontology";
import {
canonicalSort,
typeTranslation,
} from '../utils/generic-functions';
import {
fieldList,
properties,
biblioProperties,
bioProperties,
} from "../utils/record-ontology";
import {getStringLiteral} from "../utils/jsonld.model";

// A single field of a single record.
Expand Down Expand Up @@ -52,9 +60,14 @@ export var FlatFields = Backbone.Collection.extend({
this.listenTo(this.record, 'change', _.flow([this.toFlat, this.set]));
},
toFlat: function(record) {
const content = record.toJSON();
const fieldNames = Object.keys(content).filter((name) => fieldList.includes(content[name]["@type"]));
const fields = fieldNames.map((name) => ({key: name, value: content[name]}));
const properties = (
typeTranslation(record).isBibliographical ?
biblioProperties : bioProperties
);
const fields = properties.map(prop => ({
key: prop.id,
value: record.get(prop.id),
}));
return fields;
},
});

0 comments on commit 69b1e73

Please sign in to comment.