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 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 <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: {
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 @@ -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);
}
};
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 />
40 changes: 40 additions & 0 deletions src/components/Form/fields/FieldAffiliations.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import FieldAffiliations from './FieldAffiliations.vue';
import FieldAffiliationsMock from '@/components/Form/mocks/field-affiliations';
import {http, HttpResponse} from 'msw';

const args = {...FieldAffiliationsMock};

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

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