feat: show the PDF in the document view where the site draws it - #285
Merged
erseco merged 2 commits intoSep 8, 2026
Merged
Conversation
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
erseco
force-pushed
the
integra/vista-documento-pdf
branch
from
September 8, 2026 17:04
267dd33 to
eaba575
Compare
erseco
force-pushed
the
integra/vista-documento-pdf
branch
from
September 8, 2026 17:18
eaba575 to
81ec903
Compare
Apilado sobre la limpieza. La columna izquierda de la ficha encabezaba con el resumen campo a campo; ahora encabeza con el documento tal y como se va a emitir, que es lo que la gente va a mirar. La maquetación no cambia: la ficha ya era una rejilla de dos columnas con las acciones a la derecha. Solo donde el PDF se dibuja en este proceso. Con Collabora o con WASM hace falta un servicio o el navegador para producirlo, y de eso no se cuelga el render de una página; ahí la ficha se queda como estaba. Un documento sin tipo tampoco tiene nada que dibujar. El marco apunta al mismo `admin_post_documentate_preview` que ya usaban los botones de exportar, así que el fichero lo sirve el mismo código, tras la misma comprobación de `edit_post` y el mismo nonce. No se abre ninguna puerta nueva. El resumen de campos sigue ahí, plegado debajo: es la única vista que respeta el reparto área/gestión y la única donde se ve qué campos quedan vacíos. Y «Previsualizar PDF» desaparece de la ficha, porque abre en otra pestaña lo que ya está en pantalla. El editor lo conserva, que es donde sí hace falta. Un test que comprobaba que solo administración va a wp-admin buscaba la subcadena «post.php», y `admin-post.php` la contiene; ahora busca la etiqueta del enlace, que no es ambigua.
La lista repartía cinco etiquetas para dos destinos: «Corregir», «Continuar» y «Revisar» abrían el editor, «Ver PDF» y «Ver» abrían la ficha. Quien lee una bandeja no necesita que le cuenten en qué punto del circuito está —para eso está la columna de estado, justo al lado—, sino si puede tocar el documento o solo mirarlo. «Ver PDF» además bajaba a `#exportar`. La ficha ahora abre con el PDF, así que el ancla saltaba precisamente por encima de lo que iba a buscar. Lo que no cambia es a quién le sale «Editar»: administración puede modificar un documento que está en gestión, pero todavía no le toca, así que su fila sigue diciendo «Ver». Esa distinción vivía repartida entre tres condiciones y ahora tiene un nombre, `opens_the_editor()`.
erseco
force-pushed
the
integra/vista-documento-pdf
branch
from
September 8, 2026 18:51
81ec903 to
5e89945
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #284, which is stacked on #283.
The left column of the document view opened with the field-by-field summary.
It now opens with the document as it will be issued, which is what people
actually look at. The layout itself does not change: the view was already a
two-column grid with the actions on the right.
Where it applies
Only where the PDF is drawn in this process. Collabora and LibreOffice WASM
reach a service or the browser to produce one, which is not something to hang
a page render on — there the view stays as it was. A document with no type has
nothing to draw either.
The frame points at
admin_post_documentate_preview, the handler the exportbuttons already used, so the file is streamed by the same code behind the same
edit_postcheck and the same nonce. No new way in is opened.The field summary is kept, folded
It is the only view that respects the área/gestión split and the only one that
shows which fields are still empty, so it sits under the document in a closed
<details>."Previsualizar PDF" leaves the document view
It opened, in another tab, what is now already on screen. The editor keeps it,
which is where it still earns its place.
Worth knowing before merging
An área user now sees the whole rendered document — gestión's figures included
— as soon as they open the view. That is not a new permission: the same
user already had "Previsualizar PDF" and "Descargar PDF" in the same view, both
served by this same handler, so the document was always one click away. What
changes is that it is on screen by default rather than behind a button.
If that default is wrong for this workflow, the fix is one condition in
Documentate_App_Detail::render_pdf_preview()— say the word and I will gatethe frame on whoever may see every field.
Checks
make lint,make phpmd,make check-plugin,make test(2794 tests) andmake test-e2e(106 tests) all pass on this branch.