Skip to content

Commit

Permalink
Refs #131062 added Workflows.js from volto master, another commit wil…
Browse files Browse the repository at this point in the history
…l follow to have diff changes
  • Loading branch information
ichim-david committed Jun 10, 2021
1 parent 694aab2 commit bf986ba
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/customizations/volto/constants/Workflows.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Layouts.
* @module constants/Workflows
*/

import { last, split } from 'lodash';

export default function getWorkflowMapping(url, current) {
const mapping = {
published: { value: 'public', label: 'Public', color: '#007bc1', url },
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: 'private', label: 'Private', color: '#ed4033', url },
submit: { value: 'review', label: 'Review', color: '#f4e037', url },
};

if (url) {
const key = last(split(url, '/'));
if (key in mapping) {
return mapping[key];
}

return { value: key, label: key, color: '#000', url };
}

if (current in mapping) {
return mapping[current];
}

return { value: current, label: current, color: '#000', url };
}

0 comments on commit bf986ba

Please sign in to comment.