Skip to content

Commit

Permalink
Refs #124587 move state mapping to config settings making them overri…
Browse files Browse the repository at this point in the history
…dable
  • Loading branch information
ichim-david committed Jun 22, 2021
1 parent 25862dd commit f418cca
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
22 changes: 3 additions & 19 deletions src/customizations/volto/constants/Workflows.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,13 @@
*/

import { last, split } from 'lodash';
import config from '@plone/volto/registry';

export default function getWorkflowMapping(url, current) {
const mapping = {
publish: { value: 'public', label: 'Public', color: '#007bc1', url },
private: { value: 'private', label: 'Private', color: '#ed4033', url },
pending: { value: 'pending', label: 'Pending', color: '#f6a808', url },
send_back: { value: 'private', label: 'Private', color: '#ed4033', url },
retract: { value: 'retract', label: 'Retract', color: '#ed4033', url },
submit: { value: 'review', label: 'Review', color: '#f4e037', url },
retracted: {
value: 'retracted',
label: 'Retracted',
color: '#ed4033',
url,
},
published: {
value: 'published',
label: 'Published',
color: '#007bc1',
url,
},
...config?.settings?.workflows?.state_mapping,
};

mapping['url'] = url;
if (url) {
const key = last(split(url, '/'));
if (key in mapping) {
Expand Down
22 changes: 22 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ const applyConfig = (config) => {
workflowProgress,
};

config.settings.workflows = {
...config.settings.workflows,
state_mapping: {
publish: { value: 'public', label: 'Public', color: '#007bc1' },
private: { value: 'private', label: 'Private', color: '#ed4033' },
pending: { value: 'pending', label: 'Pending', color: '#f6a808' },
send_back: { value: 'private', label: 'Private', color: '#ed4033' },
retract: { value: 'retract', label: 'Retract', color: '#ed4033' },
submit: { value: 'review', label: 'Review', color: '#f4e037' },
retracted: {
value: 'retracted',
label: 'Retracted',
color: '#ed4033',
},
published: {
value: 'published',
label: 'Published',
color: '#007bc1',
},
},
};

const appExtras = config.settings.appExtras || [];

config.settings.appExtras = [
Expand Down

0 comments on commit f418cca

Please sign in to comment.