Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple author affiliations #417

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
17 changes: 17 additions & 0 deletions public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,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',
Expand Down Expand Up @@ -804,6 +805,22 @@ window.pkp = {
'The submission has been advanced to the next round of review',
'workflow.submissionNextReviewRoundInFutureStage':
'The submission advanced to the next review round, was accepted, and is currently in the {$stage} stage.',
'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 <strong>{$affiliation}</strong> 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: {
skinUrl: '/styles/tinymce',
Expand Down
4 changes: 3 additions & 1 deletion src/components/DropdownActions/DropdownActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,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);
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/components/Form/FormGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
</template>

<script>
import FieldAffiliations from './fields/FieldAffiliations.vue';
import FieldArchivingPn from './fields/FieldArchivingPn.vue';
import FieldAutosuggestPreset from './fields/FieldAutosuggestPreset.vue';
import FieldBaseAutosuggest from './fields/FieldBaseAutosuggest.vue';
Expand Down Expand Up @@ -84,6 +85,7 @@ import {shouldShowFieldWithinGroup} from './formHelpers';
export default {
name: 'FormGroup',
components: {
FieldAffiliations,
FieldArchivingPn,
FieldAutosuggestPreset,
FieldBaseAutosuggest,
Expand Down
26 changes: 26 additions & 0 deletions src/components/Form/fields/FieldAffiliations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {Primary, Controls, Stories, Meta, ArgTypes} from '@storybook/blocks';

import * as FieldAffiliationsStories from './FieldAffiliations.stories.js';

<Meta of={FieldAffiliationsStories} />

# FieldAffiliation

## Usage

A special component to maintain affiliations (institutions) of authors (contributors).

The Affiliations currently saved are shown in a tabular way.

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.

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".

The `value` are an array of Affiliation objects.

<Primary />
<Controls />
<Stories />
36 changes: 36 additions & 0 deletions src/components/Form/fields/FieldAffiliations.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import FieldAffiliations from './FieldAffiliations.vue';
import FieldAffiliationsMock from '@/components/Form/mocks/field-affiliations';
import {http, HttpResponse} from 'msw';

export default {
title: 'Forms/FieldAffiliations',
component: FieldAffiliations,
render: (args) => ({
components: {FieldAffiliations},
setup() {
return {args};
},
template: '<FieldAffiliations v-bind="args"/>',
}),
parameters: {
msw: {
handlers: [
http.get(
'https://mock/index.php/publicknowledge/api/v1/rors/?searchPhrase=Simon+Fraser+University',
async () => {
return HttpResponse.json(FieldAffiliationsMock.searchResults);
},
),
],
},
},
decorators: [
() => ({
template: '<div style="height: 600px"><story/></div>',
}),
],
};

export const Base = {
args: {...FieldAffiliationsMock},
};
Loading