Skip to content

Commit

Permalink
Pre-fill affiliations with the users' default
Browse files Browse the repository at this point in the history
  • Loading branch information
duartegalvao committed Jan 12, 2024
1 parent 8ba4b6c commit b7404b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions indico_jacow/client/MultipleAffiliationsSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,10 @@ MultipleAffiliationsButton.propTypes = {
};

export const customFields = ['jacowAffiliationsIds'];

export const onAddPersonLink = person => {
if (!person.jacowAffiliationsIds && person.affiliationId) {
person.jacowAffiliationsIds = [person.affiliationId];
person.jacowAffiliationsMeta = [person.affiliationMeta];
}
};
2 changes: 2 additions & 0 deletions indico_jacow/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import {registerPluginComponent, registerPluginObject} from 'indico/utils/plugin
import MultipleAffiliationsSelector, {
MultipleAffiliationsButton,
customFields,
onAddPersonLink,
} from './MultipleAffiliationsSelector';

const PLUGIN_NAME = 'jacow';

registerPluginComponent(PLUGIN_NAME, 'personListItemActions', MultipleAffiliationsButton);
registerPluginComponent(PLUGIN_NAME, 'personLinkFieldModals', MultipleAffiliationsSelector);
registerPluginObject(PLUGIN_NAME, 'personLinkCustomFields', customFields);
registerPluginObject(PLUGIN_NAME, 'onAddPersonLink', onAddPersonLink);

0 comments on commit b7404b7

Please sign in to comment.