Skip to content

Commit 0f99897

Browse files
committed
multiple author affiliations
1 parent b67a68d commit 0f99897

File tree

11 files changed

+1154
-2
lines changed

11 files changed

+1154
-2
lines changed

public/globals.js

+15
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,21 @@ window.pkp = {
747747
"Invitation not accepted. You're logged in as a different user.",
748748
'acceptInvitation.authorization.message':
749749
'Please log out and sign in with the correct account to accept this invitation.',
750+
'user.affiliations': 'Affiliations',
751+
'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")',
752+
'user.affiliations.institution': 'Institution',
753+
'user.affiliations.translation': 'Translation',
754+
'user.affiliations.translationEditActionLabel': 'Edit institution name',
755+
'user.affiliations.translationDeleteActionLabel': 'Remove institution',
756+
'user.affiliations.translationActionsAriaLabel': 'Click to edit or delete',
757+
'user.affiliations.translationsAllAvailable': 'All translations available',
758+
'user.affiliations.translationsSomeAvailable': '{$translated} of {$total} languages completed',
759+
'user.affiliations.typeTranslationNameInLanguageLabel': 'Type the institute name in {$language}',
760+
'user.affiliations.translationNameInLanguage': 'Institute name in {$language}',
761+
'user.affiliations.deleteModal.title': 'Are you sure?',
762+
'user.affiliations.deleteModal.message': 'The institution <strong>{$institution}</strong> will be deleted.',
763+
'user.affiliations.searchPhraseLabel': 'Type the institute name in {$language}',
764+
'user.affiliations.searchPhraseNothingFound': 'Your search phrase could not be found'
750765
},
751766

752767
tinyMCE: {

src/components/DropdownActions/DropdownActions.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ const emit = defineEmits([
124124
]);
125125
126126
const emitAction = (action) => {
127-
if (action.name) {
127+
if (action.name && (action.id || action.id === 0)) {
128+
emit('action', [action.name, action.id]);
129+
} else if (action.name) {
128130
emit('action', action.name);
129131
}
130132
};

src/components/Form/FormGroup.vue

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
</template>
5454

5555
<script>
56+
import FieldAffiliations from './fields/FieldAffiliations.vue';
5657
import FieldArchivingPn from './fields/FieldArchivingPn.vue';
5758
import FieldAutosuggestPreset from './fields/FieldAutosuggestPreset.vue';
5859
import FieldBaseAutosuggest from './fields/FieldBaseAutosuggest.vue';
@@ -84,6 +85,7 @@ import {shouldShowFieldWithinGroup} from './formHelpers';
8485
export default {
8586
name: 'FormGroup',
8687
components: {
88+
FieldAffiliations,
8789
FieldArchivingPn,
8890
FieldAutosuggestPreset,
8991
FieldBaseAutosuggest,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.
16+
The affiliation name can be retrieved from an API or entered manually.
17+
If retrieved from the API, the values will be read only.
18+
19+
The data of the API is from a cached data dump from https://ror.org.
20+
Getting and saving the data dump is done with the classes in the namespace "PKP\ror".
21+
22+
The `value` are an array of Affiliation objects.
23+
24+
<Primary />
25+
<Controls />
26+
<Stories />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import FieldAffiliations from './FieldAffiliations.vue';
2+
import FieldAffiliationsMock from '@/components/Form/mocks/field-affiliations';
3+
import {http, HttpResponse} from "msw";
4+
5+
const args = {...FieldAffiliationsMock};
6+
7+
export default {
8+
title: 'Forms/FieldAffiliations',
9+
component: FieldAffiliations,
10+
args: {},
11+
parameters: {
12+
msw: {
13+
handlers: [
14+
http.get(
15+
'https://mock/index.php/publicknowledge/api/v1/rors/?searchPhrase=Simon+Fraser+University',
16+
async () => {
17+
return HttpResponse.json(args.apiResponse);
18+
},
19+
),
20+
],
21+
},
22+
},
23+
render: (args) => ({
24+
components: {FieldAffiliations},
25+
setup() {
26+
return {args}
27+
},
28+
template: `
29+
<FieldAffiliations v-bind="args"/>`
30+
}),
31+
decorators: [
32+
() => ({
33+
template: '<div style="height: 600px"><story/></div>',
34+
}),
35+
],
36+
};
37+
38+
export const Base = {
39+
args: {...FieldAffiliationsMock},
40+
};

0 commit comments

Comments
 (0)