Skip to content

Commit b5532e7

Browse files
authored
Merge pull request #507 from bozana/7135
pkp/pkp-lib#7135 Multiple author affiliations (Ror)
2 parents 5ef5ae4 + 34e219c commit b5532e7

12 files changed

+1136
-54
lines changed

public/globals.js

+17
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ window.pkp = {
158158
'article.metadata': 'Metadata',
159159
'author.users.contributor.principalContact': 'Primary Contact',
160160
'author.users.contributor.setPrincipalContact': 'Set Primary Contact',
161+
'common.add': 'Add',
161162
'common.addCCBCC': 'Add CC/BCC',
162163
'common.assign': 'Assign',
163164
'common.attachFiles': 'Attach Files',
@@ -815,6 +816,22 @@ window.pkp = {
815816
'The submission has been advanced to the next round of review',
816817
'workflow.submissionNextReviewRoundInFutureStage':
817818
'The submission advanced to the next review round, was accepted, and is currently in the {$stage} stage.',
819+
'user.affiliations': 'Affiliations',
820+
'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")',
821+
'user.affiliations.institution': 'Institution',
822+
'user.affiliations.translation': 'More information',
823+
'user.affiliations.translationEditActionLabel': 'Edit institution name',
824+
'user.affiliations.translationDeleteActionLabel': 'Remove institution',
825+
'user.affiliations.translationActionsAriaLabel': 'Click to edit or delete',
826+
'user.affiliations.translationsAllAvailable': 'All translations available',
827+
'user.affiliations.translationsSomeAvailable': '{$count} of {$total} languages completed',
828+
'user.affiliations.typeTranslationNameInLanguageLabel': 'Type the institute name in {$language}',
829+
'user.affiliations.translationNameInLanguage': 'Institute name in {$language}',
830+
'user.affiliations.deleteModal.title': 'Are you sure?',
831+
'user.affiliations.deleteModal.message': 'The affiliation <strong>{$affiliation}</strong> will be deleted.',
832+
'user.affiliations.searchPhraseLabel': 'Type the institute name in {$language}',
833+
'user.affiliations.searchPhraseNothingFound': 'Your search phrase could not be found',
834+
'user.affiliations.primaryLocaleRequired': 'The primary language {$primaryLocale} is required',
818835
},
819836
tinyMCE: {
820837
skinUrl: '/styles/tinymce',

src/components/Form/Form.vue

+9
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,17 @@ export default {
574574
'[id*="' + this.id + '-' + field.name + '"]',
575575
);
576576
if ($el) {
577+
// Handle scrolling within new side modals
578+
const containers = document.querySelectorAll(
579+
'div.pkp-modal-scroll-container',
580+
);
581+
const lastContainer =
582+
containers.length > 0
583+
? containers[containers.length - 1]
584+
: undefined;
577585
this.$scrollTo($el, 500, {
578586
offset: -50,
587+
container: lastContainer,
579588
});
580589
} else {
581590
this.setCurrentPage(group.pageId);

src/components/Form/FormGroup.vue

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
:key="field.name"
4444
:all-errors="errors"
4545
:form-id="formId"
46+
:primary-locale="primaryLocale"
47+
:locales="availableLocales"
4648
@change="fieldChanged"
4749
@set-errors="setFieldErrors"
4850
></component>
@@ -53,6 +55,7 @@
5355
</template>
5456

5557
<script>
58+
import FieldAffiliations from './fields/FieldAffiliations.vue';
5659
import FieldArchivingPn from './fields/FieldArchivingPn.vue';
5760
import FieldAutosuggestPreset from './fields/FieldAutosuggestPreset.vue';
5861
import FieldBaseAutosuggest from './fields/FieldBaseAutosuggest.vue';
@@ -84,6 +87,7 @@ import {shouldShowFieldWithinGroup} from './formHelpers';
8487
export default {
8588
name: 'FormGroup',
8689
components: {
90+
FieldAffiliations,
8791
FieldArchivingPn,
8892
FieldAutosuggestPreset,
8993
FieldBaseAutosuggest,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import {Primary, Controls, Stories, Meta, ArgTypes} from '@storybook/blocks';
2+
3+
import * as FieldAffiliationsStories from './FieldAffiliations.stories.js';
4+
5+
<Meta of={FieldAffiliationsStories} />
6+
7+
# FieldAffiliation
8+
9+
## Usage
10+
11+
A special component to maintain affiliations (institutions) of authors (contributors).
12+
13+
The Affiliations currently saved are shown in a tabular way.
14+
15+
The default locale name and a clickable status message is shown, which shows which translations are saved. The affiliation name can be retrieved from an API or entered manually. If retrieved from the API, the values will be read only.
16+
17+
The data of the API is from a cached data dump from https://ror.org. Getting and saving the data dump is done with the classes in the namespace "PKP\ror".
18+
19+
The `value` are an array of Affiliation objects.
20+
21+
<Primary />
22+
<Controls />
23+
<Stories />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {http, HttpResponse} from 'msw';
2+
import FieldAffiliations from './FieldAffiliations.vue';
3+
import FieldAffiliationsMock from '@/components/Form/mocks/field-affiliations';
4+
5+
export default {
6+
title: 'Forms/FieldAffiliations',
7+
component: FieldAffiliations,
8+
render: (args) => ({
9+
components: {FieldAffiliations},
10+
setup() {
11+
function change(name, prop, newValue, localeKey) {
12+
if (localeKey) {
13+
args[prop][localeKey] = newValue;
14+
} else {
15+
args[prop] = newValue;
16+
}
17+
}
18+
19+
return {args, change};
20+
},
21+
template: '<FieldAffiliations v-bind="args" @change="change"/>',
22+
}),
23+
parameters: {
24+
msw: {
25+
handlers: [
26+
http.get('https://api.ror.org/v2/organizations', async () => {
27+
return HttpResponse.json(FieldAffiliationsMock.organizations);
28+
}),
29+
http.post(
30+
'https://mock/index.php/publicknowledge/api/v1/rors/',
31+
async () => {
32+
return HttpResponse.json();
33+
},
34+
),
35+
],
36+
},
37+
docs: {
38+
story: {
39+
height: '500px',
40+
},
41+
},
42+
},
43+
};
44+
45+
export const Base = {
46+
args: {...FieldAffiliationsMock},
47+
};

0 commit comments

Comments
 (0)