Skip to content

Commit

Permalink
Duty of Care Updates (#229)
Browse files Browse the repository at this point in the history
Co-authored-by: Ray Lee <ray.lee@lyrasis.org>
  • Loading branch information
mikejritter and ray-lee authored Jul 30, 2024
1 parent 75261c1 commit a094f37
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/plugins/recordTypes/dutyofcare/advancedSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default (configContext) => {
value: [
{
op: OP_CONTAIN,
path: 'ns2:dutyofcares_common/dutyOfCareNumber',
path: 'ns2:dutiesofcare_common/dutyOfCareNumber',
},
...extensions.core.advancedSearch,
],
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/recordTypes/dutyofcare/columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ export default (configContext) => {
},
}),
order: 10,
sortBy: 'dutyofcares_common:dutyOfCareNumber',
sortBy: 'dutiesofcare_common:dutyOfCareNumber',
width: 200,
},
title: {
dutyOfCareTitle: {
messages: defineMessages({
label: {
id: 'column.dutyofcare.default.title',
id: 'column.dutyofcare.default.dutyOfCareTitle',
defaultMessage: 'Title',
},
}),
order: 20,
sortBy: 'dutyofcares_common:title',
sortBy: 'dutiesofcare_common:dutyOfCareTitle',
width: 200,
},
updatedAt: {
Expand Down
64 changes: 32 additions & 32 deletions src/plugins/recordTypes/dutyofcare/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export default (configContext) => {
view: {
type: CompoundInput,
props: {
defaultChildSubpath: 'ns2:dutyofcares_common',
defaultChildSubpath: 'ns2:dutiesofcare_common',
},
},
},
...extensions.core.fields,
'ns2:dutyofcares_common': {
'ns2:dutiesofcare_common': {
[config]: {
service: {
ns: 'http://collectionspace.org/services/dutyofcare',
Expand All @@ -48,11 +48,11 @@ export default (configContext) => {
cloneable: false,
messages: defineMessages({
inUse: {
id: 'field.dutyofcares_common.dutyOfCareNumber.inUse',
id: 'field.dutiesofcare_common.dutyOfCareNumber.inUse',
defaultMessage: 'The identification number {value} is in use by another record.',
},
name: {
id: 'field.dutyofcares_common.dutyOfCareNumber.name',
id: 'field.dutiesofcare_common.dutyOfCareNumber.name',
defaultMessage: 'Duty of care number',
},
}),
Expand All @@ -63,7 +63,7 @@ export default (configContext) => {
validate: (validationContext) => validateNotInUse({
configContext,
validationContext,
fieldName: 'dutyofcares_common:dutyOfCareNumber',
fieldName: 'dutiesofcare_common:dutyOfCareNumber',
}),
view: {
type: IDGeneratorInput,
Expand All @@ -78,7 +78,7 @@ export default (configContext) => {
dataType: DATA_TYPE_DATE,
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.originationDate.name',
id: 'field.dutiesofcare_common.originationDate.name',
defaultMessage: 'Origination date',
},
}),
Expand All @@ -87,11 +87,11 @@ export default (configContext) => {
},
},
},
title: {
dutyOfCareTitle: {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.title.name',
id: 'field.dutiesofcare_common.dutyOfCareTitle.name',
defaultMessage: 'Title',
},
}),
Expand All @@ -110,7 +110,7 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.note.name',
id: 'field.dutiesofcare_common.note.name',
defaultMessage: 'Note',
},
}),
Expand All @@ -134,7 +134,7 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.detailGroup.name',
id: 'field.dutiesofcare_common.detailGroup.name',
defaultMessage: 'Duty of care detail',
},
}),
Expand All @@ -147,11 +147,11 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailType.fullName',
id: 'field.dutiesofcare_common.detailType.fullName',
defaultMessage: 'Duty of care detail type',
},
name: {
id: 'field.dutyofcares_common.detailType.name',
id: 'field.dutiesofcare_common.detailType.name',
defaultMessage: 'Type',
},
}),
Expand All @@ -167,11 +167,11 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailLevel.fullName',
id: 'field.dutiesofcare_common.detailLevel.fullName',
defaultMessage: 'Duty of care detail level',
},
name: {
id: 'field.dutyofcares_common.detailLevel.name',
id: 'field.dutiesofcare_common.detailLevel.name',
defaultMessage: 'Level',
},
}),
Expand All @@ -187,18 +187,18 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailDeterminedBy.fullName',
id: 'field.dutiesofcare_common.detailDeterminedBy.fullName',
defaultMessage: 'Duty of care detail determined by',
},
name: {
id: 'field.dutyofcares_common.detailDeterminedBy.name',
id: 'field.dutiesofcare_common.detailDeterminedBy.name',
defaultMessage: 'Determined by',
},
}),
view: {
type: AutocompleteInput,
props: {
source: 'person/local,person/ulan,organization/local,organization/ulan',
source: 'person/local,organization/local',
},
},
},
Expand All @@ -208,11 +208,11 @@ export default (configContext) => {
dataType: DATA_TYPE_DATE,
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailDeterminationDate.fullName',
id: 'field.dutiesofcare_common.detailDeterminationDate.fullName',
defaultMessage: 'Duty of care detail determination date',
},
name: {
id: 'field.dutyofcares_common.detailDeterminationDate.name',
id: 'field.dutiesofcare_common.detailDeterminationDate.name',
defaultMessage: 'Determination date',
},
}),
Expand All @@ -225,11 +225,11 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.detailNote.fullName',
id: 'field.dutiesofcare_common.detailNote.fullName',
defaultMessage: 'Duty of care detail note',
},
name: {
id: 'field.dutyofcares_common.detailNote.name',
id: 'field.dutiesofcare_common.detailNote.name',
defaultMessage: 'Note',
},
}),
Expand All @@ -253,7 +253,7 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
name: {
id: 'field.dutyofcares_common.partiesInvolvedGroup.name',
id: 'field.dutiesofcare_common.partiesInvolvedGroup.name',
defaultMessage: 'Party involved',
},
}),
Expand All @@ -269,18 +269,18 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.involvedParty.fullName',
defaultMessage: 'Party involved name',
id: 'field.dutiesofcare_common.involvedParty.fullName',
defaultMessage: 'Party involved person',
},
name: {
id: 'field.dutyofcares_common.involvedParty.name',
defaultMessage: 'Name',
id: 'field.dutiesofcare_common.involvedParty.name',
defaultMessage: 'Person',
},
}),
view: {
type: AutocompleteInput,
props: {
source: 'person/local,person/ulan',
source: 'person/local',
},
},
},
Expand All @@ -289,18 +289,18 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.involvedOnBehalfOf.fullName',
id: 'field.dutiesofcare_common.involvedOnBehalfOf.fullName',
defaultMessage: 'Party involved on behalf of',
},
name: {
id: 'field.dutyofcares_common.involvedOnBehalfOf.name',
id: 'field.dutiesofcare_common.involvedOnBehalfOf.name',
defaultMessage: 'On behalf of',
},
}),
view: {
type: AutocompleteInput,
props: {
source: 'organization/local,organization/ulan',
source: 'organization/local',
},
},
},
Expand All @@ -309,11 +309,11 @@ export default (configContext) => {
[config]: {
messages: defineMessages({
fullName: {
id: 'field.dutyofcares_common.involvedRole.fullName',
id: 'field.dutiesofcare_common.involvedRole.fullName',
defaultMessage: 'Party involved roles',
},
name: {
id: 'field.dutyofcares_common.involvedRole.name',
id: 'field.dutiesofcare_common.involvedRole.name',
defaultMessage: 'Role',
},
}),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/recordTypes/dutyofcare/forms/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const template = (configContext) => {
<Cols>
<Col>
<Field name="dutyOfCareNumber" />
<Field name="title" />
<Field name="dutyOfCareTitle" />
</Col>
<Col>
<Field name="originationDate" />
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/recordTypes/dutyofcare/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
collectionName: {
id: 'record.dutyofcare.collectionName',
description: 'The name of a collection of records of the type.',
defaultMessage: 'Duty of Cares',
defaultMessage: 'Duties of Care',
},
}),
panel: defineMessages({
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/recordTypes/dutyofcare/serviceConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
serviceName: 'Dutyofcare',
servicePath: 'dutyofcares',
servicePath: 'dutiesofcare',
serviceType: 'procedure',

objectName: 'Dutyofcare',
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/recordTypes/dutyofcare/title.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ export default (configContext) => (data) => {
return '';
}

const common = getPart(data, 'dutyofcares_common');
const common = getPart(data, 'dutiesofcare_common');

if (!common) {
return '';
}

const referenceNumber = common.get('dutyOfCareNumber');
const title = common.get('title');
const dutyOfCareTitle = common.get('dutyOfCareTitle');

return [referenceNumber, title].filter((part) => !!part).join(' – ');
return [referenceNumber, dutyOfCareTitle].filter((part) => !!part).join(' – ');
};
20 changes: 10 additions & 10 deletions test/specs/plugins/recordTypes/dutyofcare/title.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ describe('dutyofcare record title', () => {
const configContext = createConfigContext();
const title = createTitleGetter(configContext);

it('should return the dutyofcare number and title when both are present', () => {
it('should return the dutyofcare number and dutyOfCareTitle when both are present', () => {
const data = Immutable.fromJS({
document: {
'ns2:dutyofcares_common': {
'ns2:dutiesofcare_common': {
dutyOfCareNumber: 'DC',
title: 'Title',
dutyOfCareTitle: 'Title',
},
},
});

title(data).should.equal('DC – Title');
});

it('should return the dutyofcare number only when the title is missing', () => {
it('should return the dutyofcare number only when the dutyOfCareTitle is missing', () => {
const data = Immutable.fromJS({
document: {
'ns2:dutyofcares_common': {
'ns2:dutiesofcare_common': {
dutyOfCareNumber: 'DC',
},
},
Expand All @@ -33,11 +33,11 @@ describe('dutyofcare record title', () => {
title(data).should.equal('DC');
});

it('should return the title only when the dutyofcare number is missing', () => {
it('should return the dutyOfCareTitle only when the dutyofcare number is missing', () => {
const data = Immutable.fromJS({
document: {
'ns2:dutyofcares_common': {
title: 'Title',
'ns2:dutiesofcare_common': {
dutyOfCareTitle: 'Title',
},
},
});
Expand All @@ -53,8 +53,8 @@ describe('dutyofcare record title', () => {
it('should return an empty string if the common part is not present', () => {
const data = Immutable.fromJS({
document: {
'ns2:dutyofcares_extension': {
dutyofcareAltTitle: 'Alt dutyofcare title',
'ns2:dutiesofcare_extension': {
dutyofcareAltTitle: 'Alt dutyofcare dutyOfCareTitle',
},
},
});
Expand Down

0 comments on commit a094f37

Please sign in to comment.