diff --git a/public/globals.js b/public/globals.js index 3c1d364a..fadb8fd6 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', @@ -755,11 +756,11 @@ window.pkp = { 'user.affiliations.translationDeleteActionLabel': 'Remove institution', 'user.affiliations.translationActionsAriaLabel': 'Click to edit or delete', 'user.affiliations.translationsAllAvailable': 'All translations available', - 'user.affiliations.translationsSomeAvailable': '{$translated} of {$total} languages completed', + '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 institution {$institution} will be deleted.', + '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', diff --git a/src/components/Form/fields/FieldAffiliations.stories.js b/src/components/Form/fields/FieldAffiliations.stories.js index 967f7ef9..b7f7e87a 100644 --- a/src/components/Form/fields/FieldAffiliations.stories.js +++ b/src/components/Form/fields/FieldAffiliations.stories.js @@ -1,6 +1,6 @@ import FieldAffiliations from './FieldAffiliations.vue'; import FieldAffiliationsMock from '@/components/Form/mocks/field-affiliations'; -import {http, HttpResponse} from "msw"; +import {http, HttpResponse} from 'msw'; const args = {...FieldAffiliationsMock}; @@ -14,7 +14,7 @@ export default { http.get( 'https://mock/index.php/publicknowledge/api/v1/rors/?searchPhrase=Simon+Fraser+University', async () => { - return HttpResponse.json(args.apiResponse); + return HttpResponse.json(args.searchResults); }, ), ], @@ -23,10 +23,10 @@ export default { render: (args) => ({ components: {FieldAffiliations}, setup() { - return {args} + return {args}; }, template: ` - ` + `, }), decorators: [ () => ({ diff --git a/src/components/Form/fields/FieldAffiliations.vue b/src/components/Form/fields/FieldAffiliations.vue index b7eb4706..2c283768 100644 --- a/src/components/Form/fields/FieldAffiliations.vue +++ b/src/components/Form/fields/FieldAffiliations.vue @@ -20,17 +20,23 @@   - + - - {{ row.name[primaryLocale] }} + + {{ affiliation.name[primaryLocale] }} {{ @@ -39,7 +45,7 @@ }) }} - +   @@ -48,48 +54,65 @@ -
+
- {{ t('common.close', {}) }} - + @@ -155,8 +178,8 @@
  • -
    +
    {{ - newAffiliationPending.ror + newAffiliation.ror ? t( 'user.affiliations.typeTranslationNameInLanguageLabel', - {language: getLocaleDisplayName(localeAddMode)}, - ) - : getLocaleDisplayName(localeAddMode) + { + language: getLocaleDisplayName( + newAffiliationNameLocale, + ), + }, + ) + : getLocaleDisplayName(newAffiliationNameLocale) }}
    - @@ -258,10 +300,11 @@ @@ -573,11 +703,6 @@ function sortNamesPrimaryFirst(names) { .dropDownActions svg { width: 1.5em; } - - .link-disabled { - opacity: 0.5; - pointer-events: none; - } } .pkpFormField--affiliations__control .searchPhraseResults { diff --git a/src/components/Form/mocks/field-affiliations.js b/src/components/Form/mocks/field-affiliations.js index 664aae1b..86be1b03 100644 --- a/src/components/Form/mocks/field-affiliations.js +++ b/src/components/Form/mocks/field-affiliations.js @@ -3,7 +3,7 @@ export default { component: 'author-affiliations', authorId: 1, primaryLocale: 'en', - supportedFormLocales: [ + locales: [ {key: 'en', label: 'English'}, {key: 'fr_CA', label: 'French (Canada)'}, {key: 'de', label: 'German'}, @@ -41,7 +41,7 @@ export default { }, }, ], - apiResponse: { + searchResults: { itemsMax: 110723, items: [ { @@ -376,7 +376,7 @@ export default { }, ], }, - newAffiliationPending: { + newAffiliation: { id: null, authorId: 1, ror: null, diff --git a/src/components/ListPanel/contributors/ContributorsListPanel.vue b/src/components/ListPanel/contributors/ContributorsListPanel.vue index 9c584937..4c3e1029 100644 --- a/src/components/ListPanel/contributors/ContributorsListPanel.vue +++ b/src/components/ListPanel/contributors/ContributorsListPanel.vue @@ -297,7 +297,7 @@ export default { activeForm.fields = activeForm.fields.map((field) => { if (field.name === 'affiliations') { field.primaryLocale = activeForm.primaryLocale; - field.supportedFormLocales = activeForm.supportedFormLocales; + field.locales = activeForm.supportedFormLocales; } return field; }); @@ -405,7 +405,7 @@ export default { } else if (field.name === 'affiliations') { field.authorId = author['id']; field.primaryLocale = activeForm.primaryLocale; - field.supportedFormLocales = activeForm.supportedFormLocales; + field.locales = activeForm.supportedFormLocales; field.value = author[field.name]; } else if (Object.keys(author).includes(field.name)) { field.value = author[field.name];