Skip to content

Commit 0961ae0

Browse files
Merge pull request #929 from aXenDeveloper/feat/support_custom_img_forums
feat(forum): Add support custom img in forums
2 parents c3afc9c + aac964e commit 0961ae0

88 files changed

Lines changed: 2560 additions & 638 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "core_content_containers" ADD COLUMN "translations" jsonb DEFAULT '{}' NOT NULL;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"type": "diff",
3+
"version": "9",
4+
"dialect": "postgres",
5+
"id": "5941daf3-1607-4ffb-9ffa-1efff1159e1d",
6+
"prevIds": [
7+
"20d31aad-bc7f-4e35-b1f6-059bd8899c2b"
8+
],
9+
"footprints": [
10+
{
11+
"statementType": "add_column",
12+
"statementTarget": [
13+
"column",
14+
"public",
15+
"core_content_containers",
16+
"translations"
17+
],
18+
"writes": [
19+
"s|col|public.core_content_containers.translations",
20+
"n|col|public.core_content_containers.translations",
21+
"e|col|public.core_content_containers.translations"
22+
],
23+
"reads": [
24+
"n|tbl|public.core_content_containers",
25+
"n|sch|public"
26+
]
27+
}
28+
],
29+
"deltas": [
30+
{
31+
"op": "create",
32+
"row": {
33+
"schema": "public",
34+
"table": "core_content_containers",
35+
"name": "translations",
36+
"type": "jsonb",
37+
"typeSchema": null,
38+
"notNull": true,
39+
"dimensions": 0,
40+
"default": "'{}'",
41+
"generated": null,
42+
"identity": null,
43+
"entityType": "columns"
44+
}
45+
}
46+
]
47+
}

‎apps/web/content/docs/content-engine/access-categories.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Comments need nothing: a record that answers a parent through its thread root, l
8080

8181
### Restrict a category
8282

83-
Open **AdminCP → Categories** (`/admin/content/blog/categories`). In a category's row, choose **Access** (the lock button beside **Edit**). Turn off **Inherit** under **Read**, untick **Guests** and **Signed-in members**, then open **Roles** and leave only the role you want ticked. Choose **Save access**.
83+
Open **AdminCP → Categories** (`/admin/blog/categories`). In a category's row, choose **Access** (the lock button beside **Edit**). Turn off **Inherit** under **Read**, untick **Guests** and **Signed-in members**, then open **Roles** and leave only the role you want ticked. Choose **Save access**.
8484

8585
The article editor shows **Who can see this** under the categories field. It asks the server what the selected categories require together, so it is right before you save.
8686

‎apps/web/content/docs/content-engine/access.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Turn access on only when every custom route of the plugin that reads topics or c
9898

9999
### Restrict a forum in the AdminCP
100100

101-
Open **AdminCP → Forums** (`/admin/containers/forum/forums`). In a forum's row menu, choose **Access**.
101+
Open **AdminCP → Forums** (`/admin/forum/forums`). In a forum's row menu, choose **Access**.
102102

103103
The **Access** dialog is a grid: groups down the side (**Guests**, **Signed-in members** and **Roles**, which opens into every role), the four actions across the top. For a forum called "Members", turn off **Inherit** under **View**, untick **Guests** and choose **Save access**.
104104

‎apps/web/content/docs/content-engine/admincp.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import rowActions from "./admincp-row-actions.webp";
1212

1313
Every content type registered in the plugin's `src/admin/content.tsx` gets an AdminCP list and a create and edit form without any UI code. Most changes are options in the definition's `admin` block. For anything the options cannot express, you swap one cell, one field or the whole form layout for your own component.
1414

15-
This page uses the newsroom plugin's `newsroom.story`. Its screen lives at `/admin/content/newsroom/stories`.
15+
This page uses the newsroom plugin's `newsroom.story`. Its screen lives at `/admin/newsroom/stories`.
1616

1717
## Choose list columns, search and sorting
1818

@@ -66,7 +66,7 @@ Every mistake here, such as an unknown field or a gallery in `columns`, throws a
6666

6767
| Option | Default | What it does |
6868
| ------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
69-
| `path` | The id with dots as slashes | URL under `/admin/content/`. Lowercase segments of letters, digits and dashes; cannot end in `create` or `edit`. |
69+
| `path` | The id with dots as slashes | URL under `/admin/`. Lowercase segments of letters, digits and dashes; cannot start with `core` or end in `create` or `edit`. |
7070
| `titleField` | First shared text or textarea field | Names a record in toasts, dialogs and relation pickers. `null` means the type has no title. |
7171
| `colorField` | none | A shared field with a color, shown as a swatch next to the title. The blog's categories use it. |
7272
| `navigation` | `true` | Set it to `false` to keep the screen but drop its sidebar link. |
@@ -167,7 +167,7 @@ admin: {
167167
},
168168
```
169169

170-
The create form moves to `/admin/content/blog/articles/create` and the edit form to `/admin/content/blog/articles/{id}/edit`. You can set the two modes independently.
170+
The create form moves to `/admin/blog/articles/create` and the edit form to `/admin/blog/articles/{id}/edit`. You can set the two modes independently.
171171

172172
## Replace a field or a cell
173173

‎apps/web/content/docs/content-engine/approval-notices.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Approval only exists for records filed in a container whose definition has `poli
3333

3434
- **A container with policies.** The forum's `forumContainers` in `plugins/forum/src/content/forums.ts` sets `policies: { defaults: { ... } }`.
3535
- **A record filed in it.** `forum.topic` has `forum: field.container({ definition: forumContainers, required: true })`. A comment can inherit its topic's forum with `field.relation({ target: () => topicContentType, container: true })`.
36-
- **A rule that waits.** In the AdminCP, open `/admin/containers/forum/forums`, choose **Publishing** in a forum's row menu, set **Edits to published posts** to **Wait for approval** for topics and choose **Save rules**.
36+
- **A rule that waits.** In the AdminCP, open `/admin/forum/forums`, choose **Publishing** in a forum's row menu, set **Edits to published posts** to **Wait for approval** for topics and choose **Save rules**.
3737

3838
You also need an edit page that loads `GET /{id}/edit` and saves with `useContentPublicWrite`, like the [Edit form](/docs/content-engine/public-write-edit), and a member who is not a moderator in that forum. The excerpts use two names from such a page:
3939

‎apps/web/content/docs/content-engine/container-policies.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Turning policies on also gives each content type in the collection container-sco
8484

8585
### Override one container in the AdminCP
8686

87-
Open the collection's screen, such as `/admin/containers/forum/forums`. In a forum's row menu, choose **Publishing**. The **Publishing rules** sheet has one section per content type, with these settings:
87+
Open the collection's screen, such as `/admin/forum/forums`. In a forum's row menu, choose **Publishing**. The **Publishing rules** sheet has one section per content type, with these settings:
8888

8989
| Setting | Key | Choices |
9090
| ---------------------------- | ------------------- | ----------------------------------------------------------- |

‎apps/web/content/docs/content-engine/containers.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Every container already has `id`, `parentId`, `name`, `slug`, `position` and `de
9494
| `admin` | `{ path?; permissionModule?; navigation? }` | No | see below | The AdminCP screen and its staff permissions |
9595
| `policies` | `{ defaults?; contentTypes? }` \| `false` | No | off | Per-container publishing rules. See [Publishing rules](/docs/content-engine/container-policies) |
9696

97-
`admin.path` defaults to the id with dots turned into slashes (`newsroom/desks`), so the screen opens at `/admin/containers/newsroom/desks`. `admin.permissionModule` defaults to the snake-cased id (`newsroom_desks`), and `admin.navigation: false` hides the sidebar entry.
97+
`admin.path` defaults to the id with dots turned into slashes (`newsroom/desks`), so the screen opens at `/admin/newsroom/desks`. It shares that URL space with content types, so it cannot match a content type's `admin.path` or start with `core`. `admin.permissionModule` defaults to the snake-cased id (`newsroom_desks`), and `admin.navigation: false` hides the sidebar entry.
9898

9999
</Step>
100100

@@ -271,7 +271,7 @@ The collection itself needs no table, because every definition shares `core_cont
271271

272272
## Manage containers in the AdminCP
273273

274-
Open **AdminCP → Newsroom → Desks** (`/admin/containers/newsroom/desks`). Staff need the collection's `can_view` permission to see it, and `can_create`, `can_edit` or `can_delete` for each action.
274+
Open **AdminCP → Newsroom → Desks** (`/admin/newsroom/desks`). Staff need the collection's `can_view` permission to see it, and `can_create`, `can_edit` or `can_delete` for each action.
275275

276276
- **The tree** shows every desk with its children nested below it. Drag a desk to reorder it among its siblings or to drop it inside another desk.
277277
- **Create and edit** open a sheet with the name, the slug and the collection's own fields. A container created without a slug gets one derived from its name.

‎apps/web/content/docs/content-engine/create-a-content-type.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const articleContentType = defineContentType({
8686
- `tableName` is the Postgres table.
8787
- The engine fills `slug` from the title when you leave it empty, and keeps it when the title changes later, so links keep working.
8888
- `body` is [rich text](/docs/content-engine/rich-text). The AdminCP shows an editor, and the database stores a JSON document.
89-
- `admin.path` puts the screen at `/admin/content/newsroom/articles`. `list.columns` may name your fields and the system columns `id`, `createdAt` and `updatedAt`.
89+
- `admin.path` puts the screen at `/admin/newsroom/articles`. `list.columns` may name your fields and the system columns `id`, `createdAt` and `updatedAt`.
9090

9191
[Fields](/docs/content-engine/fields) lists every field helper.
9292

‎apps/web/content/docs/content-engine/fields.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ content: field.richText({ localized: true, required: true }),
109109
| ----------- | --------- | -------- | ------- | ------------------------------------------------------- |
110110
| `maxBytes` | `number` | No | 1 MB | Largest document, measured as UTF-8 JSON. At most 16 MB |
111111
| `localized` | `boolean` | No | `false` | One document per language |
112-
| `uploads` | `boolean` | No | `false` | The AdminCP editor accepts images, see [Editor images](/docs/ui/editor-images) |
112+
| `uploads` | `boolean` | No | `false` | The AdminCP editor accepts images, see [Editor images and files](/docs/ui/editor#images-and-files) |
113113

114114
The value is a ProseMirror JSON document. A rich text field has no `defaultValue`, so set `required` or `nullable`. With `required: true` a document without any text or media is refused. Documents nested deeper than 64 levels are refused too. [Rich text](/docs/content-engine/rich-text) covers rendering and the plain text and HTML helpers.
115115

0 commit comments

Comments
 (0)