feat(editorial): preserve public editions and add QA review workflow
This commit is contained in:
@@ -15,6 +15,8 @@ export default function ArticleEditor({
|
||||
source,
|
||||
images,
|
||||
revisions,
|
||||
workflow,
|
||||
workflowEnabled = false,
|
||||
}: {
|
||||
resource: {
|
||||
id: number;
|
||||
@@ -36,6 +38,8 @@ export default function ArticleEditor({
|
||||
change_type: string;
|
||||
created_at: string;
|
||||
}[];
|
||||
workflowEnabled?: boolean;
|
||||
workflow?: { id: string; state: string; revision_no: number } | null;
|
||||
}) {
|
||||
const initial = () => ({
|
||||
body: content?.body ?? '',
|
||||
@@ -106,9 +110,21 @@ export default function ArticleEditor({
|
||||
<Management title={`Editar artigo — ${resource.title}`}>
|
||||
<p>
|
||||
O original, a origem e as versões permanecem na biblioteca.
|
||||
Guardar cria uma revisão editorial e retira a publicação até à
|
||||
sua acção expressa no acervo.
|
||||
{workflowEnabled
|
||||
? 'Guardar prepara uma edição privada e conserva a versão pública até à publicação explícita da nova edição aprovada.'
|
||||
: 'No editor anterior, guardar retira a publicação até à sua acção expressa no acervo.'}
|
||||
</p>
|
||||
{workflow && (
|
||||
<p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/editorial/resources/${resource.id}`}
|
||||
>
|
||||
Conferir edição {workflow.revision_no}, revisão e
|
||||
publicação
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
<p role="status">
|
||||
Revisão guardada {resource.metadata_version} ·{' '}
|
||||
{resource.published ? 'Publicado' : 'Rascunho privado'}
|
||||
|
||||
@@ -166,7 +166,9 @@ export default function Manage({
|
||||
editorialScopeOnly = false,
|
||||
managementFilters = {},
|
||||
associationOptions = {},
|
||||
editorialWorkflowEnabled = false,
|
||||
}: {
|
||||
editorialWorkflowEnabled?: boolean;
|
||||
managementFilters?: { q?: string; state?: string; intent?: string };
|
||||
associationOptions?: Record<
|
||||
string,
|
||||
@@ -984,20 +986,24 @@ export default function Manage({
|
||||
/>
|
||||
Destacar como essencial na página inicial
|
||||
</label>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.independent_review}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'independent_review',
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Foi realizada revisão independente por outro
|
||||
gestor
|
||||
</label>
|
||||
{!editorialWorkflowEnabled && (
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={
|
||||
form.data.independent_review
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'independent_review',
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Foi realizada revisão independente por
|
||||
outro gestor
|
||||
</label>
|
||||
)}
|
||||
<fieldset className="space-y-3 rounded border p-4">
|
||||
<legend className="font-semibold">
|
||||
Relações com etapas, módulos e
|
||||
@@ -1401,7 +1407,7 @@ export default function Manage({
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{disclosureAuthorization && (
|
||||
{disclosureAuthorization && !editorialWorkflowEnabled && (
|
||||
<section
|
||||
className="space-y-3 rounded border border-emerald-700 bg-emerald-50 p-5"
|
||||
aria-labelledby="disclosure-authorization-title"
|
||||
@@ -1684,31 +1690,41 @@ export default function Manage({
|
||||
>
|
||||
Ler / pré-visualizar artigo
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() => {
|
||||
setActionError('');
|
||||
router.post(
|
||||
`/management/portal-services/resources/${r.id}`,
|
||||
{ published: !r.published },
|
||||
{
|
||||
preserveScroll: true,
|
||||
onError: (errors) =>
|
||||
setActionError(
|
||||
Object.values(
|
||||
errors,
|
||||
)[0] ??
|
||||
'A transição foi recusada; confirme o estado do ficheiro, fonte e direitos.',
|
||||
),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
{r.published
|
||||
? 'Retirar da publicação'
|
||||
: 'Publicar'}
|
||||
</button>
|
||||
{editorialWorkflowEnabled && (
|
||||
<a
|
||||
className={button}
|
||||
href={`/management/editorial/resources/${r.id}`}
|
||||
>
|
||||
Revisão, aprovação e publicação
|
||||
</a>
|
||||
)}
|
||||
{(!editorialWorkflowEnabled || r.published) && (
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() => {
|
||||
setActionError('');
|
||||
router.post(
|
||||
`/management/portal-services/resources/${r.id}`,
|
||||
{ published: !r.published },
|
||||
{
|
||||
preserveScroll: true,
|
||||
onError: (errors) =>
|
||||
setActionError(
|
||||
Object.values(
|
||||
errors,
|
||||
)[0] ??
|
||||
'A transição foi recusada; confirme o estado do ficheiro, fonte e direitos.',
|
||||
),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
{r.published
|
||||
? 'Retirar da publicação'
|
||||
: 'Publicar'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{actionError && <p role="alert">{actionError}</p>}
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user