Update all guides (NL + EN) for CodePress 2.5.2 features
- Admin guide: RBAC roles, role-based dashboard, plugin types (content/system) - CodePress developer guide: plugin types, admin plugin API, SCSS compilation, asset serving - Theme developer guide: SCSS sole CSS source, css_compiled read-only, guide layout - Content manager guide: layout selection from theme.json, plugin order in frontmatter - Both NL and EN updated with identical structure - 35 files updated
This commit is contained in:
@@ -2,16 +2,45 @@
|
||||
|
||||
## Managing files
|
||||
|
||||
- **Upload** - Upload media files
|
||||
- **New folder** - Create folder structure
|
||||
- **New file** - Create a page
|
||||
- **Edit** - Modify existing content
|
||||
- **Rename** - Change file names
|
||||
- **Move** - Move content
|
||||
- **Delete** - Remove content
|
||||
- **New folder** — Create folder structure
|
||||
- **New file** — Create a page (`.md`, `.php`, `.html`)
|
||||
- **Edit** — Modify existing content in the CodeMirror editor
|
||||
- **Rename** — Change file or folder names
|
||||
- **Move** — Move content to another folder
|
||||
- **Delete** — Remove content
|
||||
- **Rename folder** — Change a folder name
|
||||
|
||||
## Editor
|
||||
## Editor (content-edit)
|
||||
|
||||
- CodeMirror with syntax highlighting
|
||||
- Toolbar for Markdown formatting
|
||||
- Shortcuts: Ctrl+S (save), Ctrl+N (new)
|
||||
- **CodeMirror** with syntax highlighting (Markdown, PHP, HTML)
|
||||
- **Toolbar** for quickly inserting Markdown
|
||||
- **Shortcuts**: Ctrl+S (save), Ctrl+N (new)
|
||||
|
||||
## Layout selection
|
||||
|
||||
On the content-edit page you can choose the layout from the layouts defined in `theme.json` (template mapping). The selected layout is stored in the frontmatter `layout:` key.
|
||||
|
||||
## Plugins on pages
|
||||
|
||||
- Content plugins (from `plugin.json` with `type: "content"`) appear in the plugin selection
|
||||
- Choose which plugins appear in the sidebar
|
||||
- **Order is adjustable** with up/down buttons
|
||||
- The plugin order is stored in the frontmatter `plugins:` key
|
||||
- Plugins are **hidden** when the chosen layout has no sidebar (e.g. `full_content`)
|
||||
|
||||
## Frontmatter
|
||||
|
||||
The editor updates the frontmatter live when layout or plugin selection changes:
|
||||
|
||||
```markdown
|
||||
---
|
||||
layout: left_sidebar
|
||||
plugins:
|
||||
- HTMLBlock
|
||||
- Navigation
|
||||
---
|
||||
|
||||
# Page title
|
||||
|
||||
Content...
|
||||
```
|
||||
@@ -1,10 +1,32 @@
|
||||
# Dashboard
|
||||
|
||||
The dashboard shows an overview of:
|
||||
The dashboard shows a **role-based overview** of the website. Which widgets are visible depends on the role of the logged-in user.
|
||||
|
||||
- Views (30 days)
|
||||
- Unique visitors
|
||||
## Roles and widgets
|
||||
|
||||
### Admin
|
||||
- Views (30 days) and unique visitors
|
||||
- Number of pages and folders
|
||||
- Active plugins
|
||||
- Recent activity
|
||||
- Quick actions
|
||||
- System information
|
||||
- Quick actions (new page, plugin, theme)
|
||||
|
||||
### Content Manager
|
||||
- Number of pages and folders
|
||||
- Recent content changes
|
||||
- Quick actions (new page, folder)
|
||||
|
||||
### BI Manager
|
||||
- Views (30 days) and unique visitors
|
||||
- Top pages
|
||||
- Recent visits
|
||||
|
||||
### Site Admin
|
||||
- Active plugins and themes
|
||||
- System information
|
||||
- Quick actions (theme, plugin, update)
|
||||
|
||||
## Access
|
||||
|
||||
The dashboard is the default page after login (`/admin/dashboard`). All roles have access to the dashboard.
|
||||
@@ -1,13 +1,40 @@
|
||||
# Users
|
||||
|
||||
## Add user
|
||||
Users are stored in `admin/config/admin.json` (file-based, no database). Each user has a **role** that determines which admin routes and sidebar items are visible.
|
||||
|
||||
## Roles
|
||||
|
||||
CodePress has four roles, defined in `AdminAuth::ROLE_PERMISSIONS`:
|
||||
|
||||
| Role | Label | Permissions |
|
||||
|------|-------|-------------|
|
||||
| `admin` | Admin | Everything (`*`) |
|
||||
| `content-manager` | Content Manager | Content management, guide |
|
||||
| `bi-manager` | BI Manager | Statistics, logs, guide |
|
||||
| `site-admin` | Site Admin | Theme, plugins, statistics, logs, update, guide |
|
||||
|
||||
Roles are displayed with their label via `AdminAuth::ROLE_LABELS`.
|
||||
|
||||
## Adding a user
|
||||
|
||||
1. Go to **Users**
|
||||
2. Enter username
|
||||
3. Choose password
|
||||
4. Click **Add**
|
||||
3. Choose password (stored as bcrypt hash)
|
||||
4. Select a role
|
||||
5. Click **Add**
|
||||
|
||||
## Delete user
|
||||
## Editing a user
|
||||
|
||||
- Cannot delete own account
|
||||
- Confirm with password
|
||||
- Change password (new bcrypt hash)
|
||||
- Change role (immediately affects visible routes and sidebar items)
|
||||
|
||||
## Deleting a user
|
||||
|
||||
- Not possible for own account
|
||||
- Confirm with password
|
||||
|
||||
## Access control
|
||||
|
||||
- Route access is checked in `public/admin.php` via `AdminAuth::hasPermission()`
|
||||
- Unauthorized routes return a **403 error**
|
||||
- Sidebar items are conditionally shown via the `has_permission()` Twig function in `admin.twig`
|
||||
@@ -1,15 +1,49 @@
|
||||
# Plugins
|
||||
|
||||
## Plugin types
|
||||
|
||||
CodePress has two kinds of plugins, determined by the `type` field in `plugin.json`:
|
||||
|
||||
- **Content plugins** (`type: "content"`) — Appear in the sidebar and in the plugin selection on content-edit pages. Provide sidebar content via `getSidebarContent()`.
|
||||
- **System plugins** (`type: "system"`) — Are loaded by PluginManager but do NOT appear in the sidebar. Provide functionality via admin menu, routes and the CMSAPI. Registered via `getAdminMenu()` and `getAdminRoutes()`.
|
||||
|
||||
When no `type` field is present, `content` is assumed.
|
||||
|
||||
## Essential plugins
|
||||
|
||||
Essential plugins are defined in `getProtectedPlugins()` in `public/admin.php`. Current essential plugin: **Navigation**.
|
||||
|
||||
These plugins:
|
||||
- Cannot be deactivated
|
||||
- Cannot be edited
|
||||
- Cannot be deleted
|
||||
|
||||
On the plugins page they get an **Essential** badge instead of the action buttons.
|
||||
|
||||
## Managing plugins
|
||||
|
||||
- **Enable/Disable** - Turn plugins on/off
|
||||
- **Edit** - Modify plugin code
|
||||
- **Configuration** - Plugin settings
|
||||
- **Delete** - Remove plugin
|
||||
- **Activate/Deactivate** — Turn a plugin on/off (not for essential plugins)
|
||||
- **Edit** — Modify plugin code in CodeMirror (not for essential plugins)
|
||||
- **Configuration** — Edit plugin settings
|
||||
- **Delete** — Remove the plugin folder (not for essential plugins)
|
||||
|
||||
## New plugin
|
||||
The admin plugins page shows a **Content** or **System** badge per plugin.
|
||||
|
||||
## Creating a new plugin
|
||||
|
||||
1. Go to **Plugins** → **New plugin**
|
||||
2. Enter a name (e.g. `MyPlugin`)
|
||||
3. Edit `plugin.php`
|
||||
4. Enable the plugin
|
||||
2. Enter a name (e.g. `MyPlugin`) — this becomes the folder name
|
||||
3. Choose the type: **Content** or **System**
|
||||
4. The file `MyPlugin.php` is created (NOT `plugin.php`)
|
||||
5. Edit the plugin code in CodeMirror
|
||||
6. Activate the plugin
|
||||
|
||||
## Plugin filename
|
||||
|
||||
Plugin PHP files are named `<PluginName>.php` (e.g. `Navigation.php`, `HTMLBlock.php`). `PluginManager` loads `$pluginDir . '/' . $pluginName . '.php'`.
|
||||
|
||||
## Plugin CSS
|
||||
|
||||
- Content and system plugins can have their own CSS in `assets/scss/` and `assets/css/`
|
||||
- Plugin CSS is automatically loaded after theme CSS (in `base.twig`), so themes can override plugin styling
|
||||
- Plugin assets are served via `cms/router.php` at URL `/plugins/<Name>/assets/...`
|
||||
@@ -2,20 +2,65 @@
|
||||
|
||||
## Managing themes
|
||||
|
||||
1. Go to **Theme** in admin menu
|
||||
2. **Activate** - Choose active theme
|
||||
3. **Compile SCSS** - Process SCSS to CSS
|
||||
4. **New theme** - Create custom theme
|
||||
1. Go to **Theme** in the admin menu
|
||||
2. **Activate** — Choose the active theme (stored in `config.json`)
|
||||
3. **Compile SCSS** — Process SCSS to CSS (forced)
|
||||
4. **New theme** — Create a custom theme via admin or manually
|
||||
|
||||
## Theme structure
|
||||
|
||||
```
|
||||
themes/default/
|
||||
├── theme.json # Theme configuration
|
||||
├── base.twig # Main layout
|
||||
├── full_content.twig # Layouts
|
||||
├── left_sidebar.twig
|
||||
├── right_sidebar.twig
|
||||
├── partials/ # Header, nav, footer
|
||||
└── assets/ # CSS, JS, images
|
||||
```
|
||||
├── theme.json # { title, config.default_template, template: layout→.twig }
|
||||
├── base.twig # Main layout (head, header, nav, breadcrumb, footer)
|
||||
├── full_content.twig # Layout: full width
|
||||
├── left_sidebar.twig # Layout: sidebar on the left
|
||||
├── right_sidebar.twig # Layout: sidebar on the right
|
||||
├── custom1.twig # Layout: custom
|
||||
├── guide.twig # Layout: guide with sidebar (Navigation plugin)
|
||||
├── partials/ # header.twig, navigation.twig, footer.twig
|
||||
└── assets/
|
||||
├── scss/theme.scss # SCSS source (only CSS source — manual css/theme.css must not exist)
|
||||
├── css_compiled/ # Generated by scssphp (read-only, do not edit manually)
|
||||
├── css/ # External CSS (bootstrap.min.css, bootstrap-icons.css, mobile.css)
|
||||
├── js/ # app.js, bootstrap.bundle.min.js
|
||||
├── fonts/ # bootstrap-icons.woff, woff2
|
||||
└── img/ # favicon, icon, world-map
|
||||
```
|
||||
|
||||
## theme.json
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "default",
|
||||
"config": {
|
||||
"default_template": "full_content"
|
||||
},
|
||||
"template": {
|
||||
"full_content": "full_content.twig",
|
||||
"left_sidebar": "left_sidebar.twig",
|
||||
"right_sidebar": "right_sidebar.twig",
|
||||
"custom1": "custom1.twig",
|
||||
"guide": "guide.twig"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `title` — Display name in admin
|
||||
- `config.default_template` — Default layout for pages without a `layout:` frontmatter
|
||||
- `template` — Mapping from layout name to `.twig` file
|
||||
|
||||
## SCSS compilation
|
||||
|
||||
- `ThemeManager` compiles `assets/scss/theme.scss` at runtime to `assets/css_compiled/theme.css` via scssphp
|
||||
- `css_compiled/` is **read-only** — do not edit manually
|
||||
- `assets/css/theme.css` must **not** exist; otherwise `ThemeManager::getCssUrl()` ignores the SCSS
|
||||
- After SCSS changes: remove `assets/css_compiled/theme.css` and `.mtime` to force recompilation
|
||||
|
||||
## Layouts
|
||||
|
||||
Layouts are chosen via the frontmatter `layout:` key in content files. Unknown layouts fall back to `config.default_template` from `theme.json`.
|
||||
|
||||
## guide.twig
|
||||
|
||||
Special layout for guides. Injects the Navigation plugin into the sidebar for sidebar navigation. Automatically used for pages in the `guide/` folder.
|
||||
Reference in New Issue
Block a user