diff --git a/public/globals.js b/public/globals.js index 0c8538abb..fadb8fd60 100644 --- a/public/globals.js +++ b/public/globals.js @@ -125,6 +125,7 @@ window.pkp = { 'article.metadata': 'Metadata', 'author.users.contributor.principalContact': 'Primary Contact', 'author.users.contributor.setPrincipalContact': 'Set Primary Contact', + 'common.add': 'Add', 'common.addCCBCC': 'Add CC/BCC', 'common.assign': 'Assign', 'common.attachFiles': 'Attach Files', @@ -747,6 +748,22 @@ window.pkp = { "Invitation not accepted. You're logged in as a different user.", 'acceptInvitation.authorization.message': 'Please log out and sign in with the correct account to accept this invitation.', + 'user.affiliations': 'Affiliations', + 'user.affiliations.description': 'Enter the full name of the institution below, avoiding any acronyms. Select the name from the dropdown and click "Add" to include the affiliation in your profile. (e.g. "Simon Fraser University")', + 'user.affiliations.institution': 'Institution', + 'user.affiliations.translation': 'Translation', + 'user.affiliations.translationEditActionLabel': 'Edit institution name', + 'user.affiliations.translationDeleteActionLabel': 'Remove institution', + 'user.affiliations.translationActionsAriaLabel': 'Click to edit or delete', + 'user.affiliations.translationsAllAvailable': 'All translations available', + 'user.affiliations.translationsSomeAvailable': '{$count} of {$total} languages completed', + 'user.affiliations.typeTranslationNameInLanguageLabel': 'Type the institute name in {$language}', + 'user.affiliations.translationNameInLanguage': 'Institute name in {$language}', + 'user.affiliations.deleteModal.title': 'Are you sure?', + 'user.affiliations.deleteModal.message': 'The affiliation {$affiliation} will be deleted.', + 'user.affiliations.searchPhraseLabel': 'Type the institute name in {$language}', + 'user.affiliations.searchPhraseNothingFound': 'Your search phrase could not be found', + 'user.affiliations.primaryLocaleRequired': 'The primary language {$primaryLocale} is required', }, tinyMCE: { diff --git a/src/components/DropdownActions/DropdownActions.vue b/src/components/DropdownActions/DropdownActions.vue index 923fccb0a..ac379afbb 100644 --- a/src/components/DropdownActions/DropdownActions.vue +++ b/src/components/DropdownActions/DropdownActions.vue @@ -124,7 +124,9 @@ const emit = defineEmits([ ]); const emitAction = (action) => { - if (action.name) { + if (action.name && (action.id || action.id === 0)) { + emit('action', [action.name, action.id]); + } else if (action.name) { emit('action', action.name); } }; diff --git a/src/components/Form/FormGroup.vue b/src/components/Form/FormGroup.vue index ce7b6087c..843506640 100644 --- a/src/components/Form/FormGroup.vue +++ b/src/components/Form/FormGroup.vue @@ -53,6 +53,7 @@ + + diff --git a/src/components/Form/mocks/field-affiliations.js b/src/components/Form/mocks/field-affiliations.js new file mode 100644 index 000000000..86be1b039 --- /dev/null +++ b/src/components/Form/mocks/field-affiliations.js @@ -0,0 +1,385 @@ +export default { + name: 'author-affiliations', + component: 'author-affiliations', + authorId: 1, + primaryLocale: 'en', + locales: [ + {key: 'en', label: 'English'}, + {key: 'fr_CA', label: 'French (Canada)'}, + {key: 'de', label: 'German'}, + ], + value: [ + { + id: 12, + authorId: 1, + ror: 'https://ror.org/0213rcc28', + name: { + en: 'Simon Fraser University', + fr_CA: 'Simon Fraser University', + de: 'Simon Fraser University', + tr: 'TR', + }, + }, + { + id: 13, + authorId: 1, + ror: 'https://ror.org/02e2c7k09', + name: { + en: 'Delft University of Technology', + fr_CA: '', + de: 'Technische Universität Delft', + }, + }, + { + id: 14, + authorId: 1, + ror: '', + name: { + en: 'German National Library of Science and Technology', + fr_CA: '', + de: 'Technische Informationsbibliothek (TIB)', + }, + }, + ], + searchResults: { + itemsMax: 110723, + items: [ + { + id: 1, + isActive: true, + displayLocale: 'en', + displayName: 'RMIT University', + name: { + en: 'RMIT University', + fr_CA: '', + }, + ror: 'https://ror.org/04ttjf776', + }, + { + id: 2, + isActive: true, + displayLocale: 'en', + displayName: 'La Trobe University', + name: { + en: 'La Trobe University', + fr_CA: '', + }, + ror: 'https://ror.org/01rxfrp27', + }, + { + id: 3, + isActive: true, + displayLocale: 'en', + displayName: 'Victoria University', + name: { + en: 'Victoria University', + fr_CA: '', + }, + ror: 'https://ror.org/04j757h98', + }, + { + id: 4, + isActive: true, + displayLocale: 'en', + displayName: 'University of New England', + name: { + en: 'University of New England', + fr_CA: '', + }, + ror: 'https://ror.org/04r659a56', + }, + { + id: 5, + isActive: true, + displayLocale: 'en', + displayName: 'Griffith University', + name: { + en: 'Griffith University', + fr_CA: '', + }, + ror: 'https://ror.org/02sc3r913', + }, + { + id: 6, + isActive: true, + displayLocale: 'en', + displayName: 'Central Queensland University', + name: { + en: 'Central Queensland University', + fr_CA: '', + }, + ror: 'https://ror.org/023q4bk22', + }, + { + id: 7, + isActive: true, + displayLocale: 'en', + displayName: 'University of South Australia', + name: { + en: 'University of South Australia', + fr_CA: '', + }, + ror: 'https://ror.org/01p93h210', + }, + { + id: 8, + isActive: true, + displayLocale: 'en', + displayName: 'Bond University', + name: { + en: 'Bond University', + fr_CA: '', + }, + ror: 'https://ror.org/006jxzx88', + }, + { + id: 9, + isActive: true, + displayLocale: 'en', + displayName: 'Charles Sturt University', + name: { + en: 'Charles Sturt University', + fr_CA: '', + }, + ror: 'https://ror.org/00wfvh315', + }, + { + id: 10, + isActive: true, + displayLocale: 'en', + displayName: 'Federation University', + name: { + en: 'Federation University', + fr_CA: '', + }, + ror: 'https://ror.org/05qbzwv83', + }, + { + id: 11, + isActive: true, + displayLocale: 'en', + displayName: 'Burnet Institute', + name: { + en: 'Burnet Institute', + fr_CA: '', + }, + ror: 'https://ror.org/05ktbsm52', + }, + { + id: 12, + isActive: true, + displayLocale: 'en', + displayName: 'Mater Research', + name: { + en: 'Mater Research', + fr_CA: '', + }, + ror: 'https://ror.org/00nx6aa03', + }, + { + id: 13, + isActive: true, + displayLocale: 'en', + displayName: 'St Vincents Institute of Medical Research', + name: { + en: 'St Vincents Institute of Medical Research', + fr_CA: '', + }, + ror: 'https://ror.org/02k3cxs74', + }, + { + id: 14, + isActive: true, + displayLocale: 'en', + displayName: 'The Heart Research Institute', + name: { + en: 'The Heart Research Institute', + fr_CA: '', + }, + ror: 'https://ror.org/046fa4y88', + }, + { + id: 15, + isActive: true, + displayLocale: 'en', + displayName: 'University Mental Health Research Institute', + name: { + en: 'University Mental Health Research Institute', + fr_CA: '', + }, + ror: 'https://ror.org/02d439m40', + }, + { + id: 16, + isActive: true, + displayLocale: 'en', + displayName: 'Rolls-Royce (United Kingdom)', + name: { + en: 'Rolls-Royce (United Kingdom)', + fr_CA: '', + }, + ror: 'https://ror.org/04h08p482', + }, + { + id: 17, + isActive: true, + displayLocale: 'en', + displayName: 'BP (United Kingdom)', + name: { + en: 'BP (United Kingdom)', + fr_CA: '', + }, + ror: 'https://ror.org/01zctcs90', + }, + { + id: 18, + isActive: true, + displayLocale: 'en', + displayName: 'Rio Tinto (United Kingdom)', + name: { + en: 'Rio Tinto (United Kingdom)', + fr_CA: '', + }, + ror: 'https://ror.org/05m7zw681', + }, + { + id: 19, + isActive: true, + displayLocale: 'en', + displayName: 'Arup Group (United States)', + name: { + en: 'Arup Group (United States)', + fr_CA: '', + }, + ror: 'https://ror.org/03awtex73', + }, + { + id: 20, + isActive: true, + displayLocale: 'en', + displayName: 'BT Group (United Kingdom)', + name: { + en: 'BT Group (United Kingdom)', + fr_CA: '', + }, + ror: 'https://ror.org/00kv9pj15', + }, + { + id: 21, + isActive: true, + displayLocale: 'en', + displayName: 'Mater Health Services', + name: { + en: 'Mater Health Services', + fr_CA: '', + }, + ror: 'https://ror.org/03mjtdk61', + }, + { + id: 22, + isActive: true, + displayLocale: 'en', + displayName: 'Pilkington (United Kingdom)', + name: { + en: 'Pilkington (United Kingdom)', + fr_CA: '', + }, + ror: 'https://ror.org/04yyp8h20', + }, + { + id: 23, + isActive: true, + displayLocale: 'en', + displayName: 'Trojan Technologies (Canada)', + name: { + en: 'Trojan Technologies (Canada)', + fr_CA: '', + }, + ror: 'https://ror.org/022rkxt86', + }, + { + id: 24, + isActive: true, + displayLocale: 'en', + displayName: 'The Alfred Hospital', + name: { + en: 'The Alfred Hospital', + fr_CA: '', + }, + ror: 'https://ror.org/01wddqe20', + }, + { + id: 25, + isActive: true, + displayLocale: 'en', + displayName: 'Washington State Department of Health', + name: { + en: 'Washington State Department of Health', + fr_CA: '', + }, + ror: 'https://ror.org/02x2akc96', + }, + { + id: 26, + isActive: true, + displayLocale: 'en', + displayName: "Women's and Children's Hospital", + name: { + en: "Women's and Children's Hospital", + fr_CA: '', + }, + ror: 'https://ror.org/03kwrfk72', + }, + { + id: 27, + isActive: true, + displayLocale: 'en', + displayName: 'Xstrata (United Kingdom)', + name: { + en: 'Xstrata (United Kingdom)', + fr_CA: '', + }, + ror: 'https://ror.org/037mpqg03', + }, + { + id: 28, + isActive: true, + displayLocale: 'en', + displayName: 'Teck (Canada)', + name: { + en: 'Teck (Canada)', + fr_CA: '', + }, + ror: 'https://ror.org/05cggb038', + }, + { + id: 29, + isActive: true, + displayLocale: 'en', + displayName: 'Hunter New England Local Health District', + name: { + en: 'Hunter New England Local Health District', + fr_CA: '', + }, + ror: 'https://ror.org/050b31k83', + }, + { + id: 30, + isActive: true, + displayLocale: 'en', + displayName: 'Cancer Council Victoria', + name: { + en: 'Cancer Council Victoria', + fr_CA: '', + }, + ror: 'https://ror.org/023m51b03', + }, + ], + }, + newAffiliation: { + id: null, + authorId: 1, + ror: null, + name: {}, + }, +}; diff --git a/src/components/Icon/Icon.stories.js b/src/components/Icon/Icon.stories.js index 580f440c3..006374b55 100644 --- a/src/components/Icon/Icon.stories.js +++ b/src/components/Icon/Icon.stories.js @@ -149,6 +149,7 @@ export const IconGallery = { 'ReviewAssignments', 'ReviewRequestDeclined', 'ReviewSent', + 'Ror', 'Search', 'Settings', 'Sitemap', diff --git a/src/components/Icon/Icon.vue b/src/components/Icon/Icon.vue index d7f658560..b2df35a7e 100644 --- a/src/components/Icon/Icon.vue +++ b/src/components/Icon/Icon.vue @@ -97,6 +97,7 @@ import ReinstateReviewer from './icons/ReinstateReviewer.vue'; import ReviewAssignments from './icons/ReviewAssignments.vue'; import ReviewRequestDeclined from './icons/ReviewRequestDeclined.vue'; import ReviewSent from './icons/ReviewSent.vue'; +import Ror from './icons/Ror.vue'; import Search from './icons/Search.vue'; import Settings from './icons/Settings.vue'; import Sitemap from './icons/Sitemap.vue'; @@ -207,6 +208,7 @@ const svgIcons = { ReviewAssignments, ReviewRequestDeclined, ReviewSent, + Ror, Search, Settings, Sitemap, diff --git a/src/components/Icon/icons/Ror.vue b/src/components/Icon/icons/Ror.vue new file mode 100644 index 000000000..5bee17284 --- /dev/null +++ b/src/components/Icon/icons/Ror.vue @@ -0,0 +1,45 @@ + diff --git a/src/components/ListPanel/contributors/ContributorsListPanel.vue b/src/components/ListPanel/contributors/ContributorsListPanel.vue index ec832a321..ab901f5f0 100644 --- a/src/components/ListPanel/contributors/ContributorsListPanel.vue +++ b/src/components/ListPanel/contributors/ContributorsListPanel.vue @@ -294,6 +294,13 @@ export default { let activeForm = cloneDeep(this.form); activeForm.action = this.contributorsApiUrl; activeForm.method = 'POST'; + activeForm.fields = activeForm.fields.map((field) => { + if (field.name === 'affiliations') { + field.primaryLocale = activeForm.primaryLocale; + field.locales = activeForm.supportedFormLocales; + } + return field; + }); this.activeForm = activeForm; this.activeFormTitle = this.t('grid.action.addContributor'); const {openSideModal} = useModal(); @@ -395,6 +402,11 @@ export default { field.isVerified = author['orcidIsVerified'] ?? false; field.orcidVerificationRequested = author['orcidVerificationRequested']; + } else if (field.name === 'affiliations') { + field.authorId = author['id']; + field.primaryLocale = activeForm.primaryLocale; + field.locales = activeForm.supportedFormLocales; + field.value = author[field.name]; } else if (Object.keys(author).includes(field.name)) { field.value = author[field.name]; }