Skip to content

feat: document templates in the shared Add-a-document drawer - EXO-88755 - #2011

Merged
bmestrallet merged 4 commits into
feature/ai-contributionfrom
feat/EXO-88755-documents-templates
Jul 22, 2026
Merged

feat: document templates in the shared Add-a-document drawer - EXO-88755#2011
bmestrallet merged 4 commits into
feature/ai-contributionfrom
feat/EXO-88755-documents-templates

Conversation

@bmestrallet

Copy link
Copy Markdown
Contributor

Stacked on feat/EXO-88752 (PR #2010) — the diff shows only the templates work once the lower PRs merge. Retarget up the chain as they land.

What this adds

Document templates in the shared "Add a document" drawer (attachment composer + Drive "+ New → Document"), by convention: each drive's Templates folder holds the template files; they render in the drawer's "Or start from a template" section as the reused Documents-app cards.

Create from a template (name-first, option B)

  • Click a template card → it gets a primary ring and an editable title field appears right under it, pre-filled with the template's base name. Footer Create creates it with that name.
  • Collision-safe & openable: copy the template into the target folder, re-fetch the created node for a real (openable) id, and fall back to a dedupe-safe in-place duplicate on the JCR "same name sibling" 500. No backend change.
  • Non-editable source types (PDF/image) are copied but not opened in the editor.

Cards & readability

  • Full-width, stacked template cards (were fixed-width side-by-side).
  • Fixed the white hover band: the reused card's title band rendered white in the drawer (theme --allPagesMaskColor + a nested white v-card hid the white filename). Forced the activity-stream grey and made the inner name card transparent, with teleport-proof selectors.

Empty-state bootstrap (A)

  • When the Templates folder is missing and the user may edit the drive root, a one-click "Create a Templates folder" is offered; otherwise a neutral, context-aware message (space vs personal, folder-empty vs missing).

Global / cross-space templates via symlinks (B)

  • A template may be a symlink to a file in another space (a shared/global template). On create we copy the symlink target (sourceID) so the new document holds real content, not a link; symlinks whose target the viewer can't read are filtered out.

Also here

  • Mass Import (EXO-88752 territory, kept on this branch): the Drive "+ New" Import entry is renamed "Mass Import" with a distinct far fa-file-archive icon (desktop + mobile), i18n via the existing key.

Testing

Built, deployed on a local 7.3.x instance, and live-verified: name-first create + open in OnlyOffice, full-width cards, readable grey card band (confirmed via computed styles), collision fallback (no 500), and the Mass Import label/icon. Two environment notes surfaced during testing (not code): OnlyOffice's Docker container must reach the platform via a host-reachable address — browse via the LAN IP so its callback/content URLs aren't localhost (unreachable from the container).

🤖 Generated with Claude Code

@bmestrallet
bmestrallet force-pushed the feat/EXO-88752-documents-add-new-menu branch from 369b6cd to 4317c7e Compare July 22, 2026 20:28
Base automatically changed from feat/EXO-88752-documents-add-new-menu to feature/ai-contribution July 22, 2026 20:36
@bmestrallet
bmestrallet force-pushed the feat/EXO-88755-documents-templates branch from 56bc585 to 03adc67 Compare July 22, 2026 20:42
@bmestrallet
bmestrallet requested a review from ahamdi July 22, 2026 20:42
bmestrallet and others added 4 commits July 22, 2026 21:44
…88755

Make the scaffolded Templates section of the shared create-document drawer
real, entirely in the documents repo and reusing existing components.

- Source = the "Templates" folder (by convention) at the current drive's docs
  root, resolved per context (space identity in a space, user identity in
  personal) via GET /v1/documents; its files are listed and rendered.
- Cards REUSE the Documents-app grid card (documents-item-card) for the
  thumbnail preview + hover title/info bar, registered into the attachment
  bundle via initComponents.js. Real thumbnails come for free.
- Card click copies the template node into the current target folder
  (POST /v1/documents/duplicate, destinationId resolved from the drive-root
  relative path via the breadcrumb endpoint) then behaves like blank-create:
  attachment-list add / Drive refresh, and OnlyOffice open only for office
  document types (PDF/image templates are copied but not opened, avoiding an
  editor error).
- The card's hover info icon opens the existing document-info-drawer.
- Visibility: the Templates section is always shown; when the folder is
  absent/empty a neutral, context word-swapped placeholder is displayed
  (new i18n keys in attachments_en.properties).

No backend changes: reuses /v1/documents list + /v1/documents/duplicate +
/v1/documents/breadcrumb.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The '+ New' menu 'Import' entry (zip mass import) is renamed 'Mass Import' and
uses a distinct 'far fa-file-archive' icon (was the same fa-upload as the Upload
entry). i18n via the existing documents.label.zip.upload key; desktop + mobile
menus both updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…bootstrap, symlink templates - EXO-88755

Follow-up polish on the shared Add-a-document drawer's Templates section:

- Name-first create (option B): clicking a template card selects it (primary ring)
  and reveals an editable title field right under that card, pre-filled with the
  template's base name; the footer Create commits it with that name.
- Full-width, stacked template cards (were fixed-width side-by-side).
- Readable card hover band: the reused Documents card's title band rendered white
  in the drawer (theme --allPagesMaskColor + a nested white v-card hid the white
  file name); force the activity-stream grey and make the inner name card
  transparent, teleport-proof selectors.
- Collision-safe create: copy the template into the target folder, re-fetch the
  created node for a valid (openable) id, and fall back to a dedupe-safe in-place
  duplicate on the JCR 'same name sibling' 500 — no backend change.
- Bootstrap (A): when the Templates folder is missing and the user can edit the
  drive root, offer a one-click 'Create a Templates folder'; context-aware empty
  states otherwise.
- Global/other-space templates via symlinks (B): copy the symlink target
  (sourceID) so the new doc holds real content; filter symlinks whose target the
  viewer can't read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…XO-88755

The created copy was located by name (name === template.name). When the backend
de-duplicated a clashing name to 'name (1)', that match instead picked the source
template, so the option-B rename hit the template's id — renaming/consuming the
source and 503-ing (JCR refuses to rename a node OnlyOffice has open).

Fix: snapshot the destination folder's file ids before the copy (listFolderFileIds)
and pick the one new id afterwards (findNewCopy). The rename now targets the actual
copy (a fresh, unopened node). Verified live in the collision scenario: copy id != template id, rename 200, source template preserved; symlink templates also copy their target into a real file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bmestrallet
bmestrallet force-pushed the feat/EXO-88755-documents-templates branch from 03adc67 to e15fd04 Compare July 22, 2026 20:48
@bmestrallet
bmestrallet merged commit a679d44 into feature/ai-contribution Jul 22, 2026
1 check passed
@bmestrallet
bmestrallet deleted the feat/EXO-88755-documents-templates branch July 22, 2026 20:49
bmestrallet added a commit that referenced this pull request Jul 28, 2026
 (#2011)

* feat: document templates in the shared "Add a document" drawer - EXO-88755

Make the scaffolded Templates section of the shared create-document drawer
real, entirely in the documents repo and reusing existing components.

- Source = the "Templates" folder (by convention) at the current drive's docs
  root, resolved per context (space identity in a space, user identity in
  personal) via GET /v1/documents; its files are listed and rendered.
- Cards REUSE the Documents-app grid card (documents-item-card) for the
  thumbnail preview + hover title/info bar, registered into the attachment
  bundle via initComponents.js. Real thumbnails come for free.
- Card click copies the template node into the current target folder
  (POST /v1/documents/duplicate, destinationId resolved from the drive-root
  relative path via the breadcrumb endpoint) then behaves like blank-create:
  attachment-list add / Drive refresh, and OnlyOffice open only for office
  document types (PDF/image templates are copied but not opened, avoiding an
  editor error).
- The card's hover info icon opens the existing document-info-drawer.
- Visibility: the Templates section is always shown; when the folder is
  absent/empty a neutral, context word-swapped placeholder is displayed
  (new i18n keys in attachments_en.properties).

No backend changes: reuses /v1/documents list + /v1/documents/duplicate +
/v1/documents/breadcrumb.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: rename Drive Import to Mass Import with archive icon - EXO-88752

The '+ New' menu 'Import' entry (zip mass import) is renamed 'Mass Import' and
uses a distinct 'far fa-file-archive' icon (was the same fa-upload as the Upload
entry). i18n via the existing documents.label.zip.upload key; desktop + mobile
menus both updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: templates drawer — name-first create, full-width cards, folder bootstrap, symlink templates - EXO-88755

Follow-up polish on the shared Add-a-document drawer's Templates section:

- Name-first create (option B): clicking a template card selects it (primary ring)
  and reveals an editable title field right under that card, pre-filled with the
  template's base name; the footer Create commits it with that name.
- Full-width, stacked template cards (were fixed-width side-by-side).
- Readable card hover band: the reused Documents card's title band rendered white
  in the drawer (theme --allPagesMaskColor + a nested white v-card hid the white
  file name); force the activity-stream grey and make the inner name card
  transparent, teleport-proof selectors.
- Collision-safe create: copy the template into the target folder, re-fetch the
  created node for a valid (openable) id, and fall back to a dedupe-safe in-place
  duplicate on the JCR 'same name sibling' 500 — no backend change.
- Bootstrap (A): when the Templates folder is missing and the user can edit the
  drive root, offer a one-click 'Create a Templates folder'; context-aware empty
  states otherwise.
- Global/other-space templates via symlinks (B): copy the symlink target
  (sourceID) so the new doc holds real content; filter symlinks whose target the
  viewer can't read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: create-from-template targets the copy by id-diff, not by name - EXO-88755

The created copy was located by name (name === template.name). When the backend
de-duplicated a clashing name to 'name (1)', that match instead picked the source
template, so the option-B rename hit the template's id — renaming/consuming the
source and 503-ing (JCR refuses to rename a node OnlyOffice has open).

Fix: snapshot the destination folder's file ids before the copy (listFolderFileIds)
and pick the one new id afterwards (findNewCopy). The rename now targets the actual
copy (a fresh, unopened node). Verified live in the collision scenario: copy id != template id, rename 200, source template preserved; symlink templates also copy their target into a real file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Jihed525 pushed a commit that referenced this pull request Jul 30, 2026
 (#2011)

* feat: document templates in the shared "Add a document" drawer - EXO-88755

Make the scaffolded Templates section of the shared create-document drawer
real, entirely in the documents repo and reusing existing components.

- Source = the "Templates" folder (by convention) at the current drive's docs
  root, resolved per context (space identity in a space, user identity in
  personal) via GET /v1/documents; its files are listed and rendered.
- Cards REUSE the Documents-app grid card (documents-item-card) for the
  thumbnail preview + hover title/info bar, registered into the attachment
  bundle via initComponents.js. Real thumbnails come for free.
- Card click copies the template node into the current target folder
  (POST /v1/documents/duplicate, destinationId resolved from the drive-root
  relative path via the breadcrumb endpoint) then behaves like blank-create:
  attachment-list add / Drive refresh, and OnlyOffice open only for office
  document types (PDF/image templates are copied but not opened, avoiding an
  editor error).
- The card's hover info icon opens the existing document-info-drawer.
- Visibility: the Templates section is always shown; when the folder is
  absent/empty a neutral, context word-swapped placeholder is displayed
  (new i18n keys in attachments_en.properties).

No backend changes: reuses /v1/documents list + /v1/documents/duplicate +
/v1/documents/breadcrumb.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: rename Drive Import to Mass Import with archive icon - EXO-88752

The '+ New' menu 'Import' entry (zip mass import) is renamed 'Mass Import' and
uses a distinct 'far fa-file-archive' icon (was the same fa-upload as the Upload
entry). i18n via the existing documents.label.zip.upload key; desktop + mobile
menus both updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: templates drawer — name-first create, full-width cards, folder bootstrap, symlink templates - EXO-88755

Follow-up polish on the shared Add-a-document drawer's Templates section:

- Name-first create (option B): clicking a template card selects it (primary ring)
  and reveals an editable title field right under that card, pre-filled with the
  template's base name; the footer Create commits it with that name.
- Full-width, stacked template cards (were fixed-width side-by-side).
- Readable card hover band: the reused Documents card's title band rendered white
  in the drawer (theme --allPagesMaskColor + a nested white v-card hid the white
  file name); force the activity-stream grey and make the inner name card
  transparent, teleport-proof selectors.
- Collision-safe create: copy the template into the target folder, re-fetch the
  created node for a valid (openable) id, and fall back to a dedupe-safe in-place
  duplicate on the JCR 'same name sibling' 500 — no backend change.
- Bootstrap (A): when the Templates folder is missing and the user can edit the
  drive root, offer a one-click 'Create a Templates folder'; context-aware empty
  states otherwise.
- Global/other-space templates via symlinks (B): copy the symlink target
  (sourceID) so the new doc holds real content; filter symlinks whose target the
  viewer can't read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: create-from-template targets the copy by id-diff, not by name - EXO-88755

The created copy was located by name (name === template.name). When the backend
de-duplicated a clashing name to 'name (1)', that match instead picked the source
template, so the option-B rename hit the template's id — renaming/consuming the
source and 503-ing (JCR refuses to rename a node OnlyOffice has open).

Fix: snapshot the destination folder's file ids before the copy (listFolderFileIds)
and pick the one new id afterwards (findNewCopy). The rename now targets the actual
copy (a fresh, unopened node). Verified live in the collision scenario: copy id != template id, rename 200, source template preserved; symlink templates also copy their target into a real file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit a679d44)
bmestrallet added a commit that referenced this pull request Aug 1, 2026
 (#2011)

* feat: document templates in the shared "Add a document" drawer - EXO-88755

Make the scaffolded Templates section of the shared create-document drawer
real, entirely in the documents repo and reusing existing components.

- Source = the "Templates" folder (by convention) at the current drive's docs
  root, resolved per context (space identity in a space, user identity in
  personal) via GET /v1/documents; its files are listed and rendered.
- Cards REUSE the Documents-app grid card (documents-item-card) for the
  thumbnail preview + hover title/info bar, registered into the attachment
  bundle via initComponents.js. Real thumbnails come for free.
- Card click copies the template node into the current target folder
  (POST /v1/documents/duplicate, destinationId resolved from the drive-root
  relative path via the breadcrumb endpoint) then behaves like blank-create:
  attachment-list add / Drive refresh, and OnlyOffice open only for office
  document types (PDF/image templates are copied but not opened, avoiding an
  editor error).
- The card's hover info icon opens the existing document-info-drawer.
- Visibility: the Templates section is always shown; when the folder is
  absent/empty a neutral, context word-swapped placeholder is displayed
  (new i18n keys in attachments_en.properties).

No backend changes: reuses /v1/documents list + /v1/documents/duplicate +
/v1/documents/breadcrumb.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: rename Drive Import to Mass Import with archive icon - EXO-88752

The '+ New' menu 'Import' entry (zip mass import) is renamed 'Mass Import' and
uses a distinct 'far fa-file-archive' icon (was the same fa-upload as the Upload
entry). i18n via the existing documents.label.zip.upload key; desktop + mobile
menus both updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* feat: templates drawer — name-first create, full-width cards, folder bootstrap, symlink templates - EXO-88755

Follow-up polish on the shared Add-a-document drawer's Templates section:

- Name-first create (option B): clicking a template card selects it (primary ring)
  and reveals an editable title field right under that card, pre-filled with the
  template's base name; the footer Create commits it with that name.
- Full-width, stacked template cards (were fixed-width side-by-side).
- Readable card hover band: the reused Documents card's title band rendered white
  in the drawer (theme --allPagesMaskColor + a nested white v-card hid the white
  file name); force the activity-stream grey and make the inner name card
  transparent, teleport-proof selectors.
- Collision-safe create: copy the template into the target folder, re-fetch the
  created node for a valid (openable) id, and fall back to a dedupe-safe in-place
  duplicate on the JCR 'same name sibling' 500 — no backend change.
- Bootstrap (A): when the Templates folder is missing and the user can edit the
  drive root, offer a one-click 'Create a Templates folder'; context-aware empty
  states otherwise.
- Global/other-space templates via symlinks (B): copy the symlink target
  (sourceID) so the new doc holds real content; filter symlinks whose target the
  viewer can't read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix: create-from-template targets the copy by id-diff, not by name - EXO-88755

The created copy was located by name (name === template.name). When the backend
de-duplicated a clashing name to 'name (1)', that match instead picked the source
template, so the option-B rename hit the template's id — renaming/consuming the
source and 503-ing (JCR refuses to rename a node OnlyOffice has open).

Fix: snapshot the destination folder's file ids before the copy (listFolderFileIds)
and pick the one new id afterwards (findNewCopy). The rename now targets the actual
copy (a fresh, unopened node). Verified live in the collision scenario: copy id != template id, rename 200, source template preserved; symlink templates also copy their target into a real file.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant