ray-template/apps/docs/en/guide/curd-examples.md
XiaoDaiGua-Ray d67e64d48c
feat(ui): refine frontend interactions and add CURD examples
Protect route drafts and refine keyboard, responsive, and primary button behavior.

Add CURD workspace examples with tests and bilingual documentation.
2026-11-27 14:51:46 +08:00

2.5 KiB

CURD interaction examples

The CURD examples menu in Ray Admin contains two business workflows. Each example below runs with its own demo data. Edits in the admin app are saved for the current browser session. Reload an embedded example to restore its initial data.

Both menu items are in the initial route configuration. To use them with a saved route snapshot, copy the CURD examples group from the initial configuration into that snapshot.

Simple example: tags

Create a tag from the toolbar or edit a tag from its row. The actions pass their own initial values and save function to the same short form. Select a tag name to read the notes in a drawer while keeping your place in the list.

Try using an existing name such as Design. The editor keeps your input if the save fails. Change a field and press Esc to choose whether to keep editing or discard your changes. The deletion confirmation names the tag it will remove.

::: details View the tag example source <<< ../../../admin/src/views/demo/curd/tags.tsx

<<< ../../../admin/src/views/demo/curd/TagEditorModal.tsx :::

Complex example: projects and milestones

The project list has name and status filters, sorting, and pagination. Create, Detail, and Edit have independent routes. Create and Edit share an editor, and Detail presents project information and milestones as readable text.

  1. Filter by In progress, open a project, and choose Edit.
  2. Change the owner or add a milestone. Cancel to choose whether to keep editing or discard the draft and return to Detail.
  3. Save to see the updated Detail. Back to projects restores the applied filters, sort, and page.
  4. Open Edit from the list to return to the list after saving or cancelling. When you delete a project, the confirmation identifies its milestones as part of the deletion.

::: details View the project list and action container source <<< ../../../admin/src/views/demo/curd/projects.tsx

<<< ../../../admin/src/views/demo/curd/project-create.tsx

<<< ../../../admin/src/views/demo/curd/project-edit.tsx

<<< ../../../admin/src/views/demo/curd/project-detail.tsx

<<< ../../../admin/src/views/demo/curd/ProjectEditor.tsx :::

Your first business page · Routes, menus, and permissions