Skip to content

Commit c0a51d9

Browse files
committed
update docs and cmspanel + config fix typo
1 parent 35259e0 commit c0a51d9

5 files changed

Lines changed: 364 additions & 452 deletions

File tree

docs/0_navigation.json

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -274,70 +274,51 @@
274274
},
275275
{
276276
"url": null,
277-
"title": {"en": "Extending the CMS"},
277+
"title": {"en": "Advanced Topics"},
278278
"target": null,
279279
"category": "doc_1.x",
280280
"type": "group",
281281
"isActive": true,
282282
"children": [
283283
{
284-
"url": {"en": "/docs/1.x/extending-the-admin-panel"},
285-
"title": {"en": "Admin Panel"},
284+
"url": {"en": "/docs/1.x/customize-the-admin-panel"},
285+
"title": {"en": "Customize the Admin Panel"},
286286
"target": null,
287287
"category": "doc_1.x",
288288
"type": "link",
289289
"isActive": true,
290290
"children": []
291291
},
292292
{
293-
"url": {"en": "/docs/1.x/middleware"},
294-
"title": {"en": "Middleware"},
293+
"url": {"en": "/docs/1.x/content-drafts-revisions"},
294+
"title": {"en": "Content Drafts & Revisions"},
295295
"target": null,
296296
"category": "doc_1.x",
297297
"type": "link",
298298
"isActive": true,
299299
"children": []
300300
},
301301
{
302-
"url": {"en": "/docs/1.x/event-listeners"},
303-
"title": {"en": "Event Listeners"},
304-
"target": null,
305-
"category": "doc_1.x",
306-
"type": "link",
307-
"isActive": true,
308-
"children": []
309-
}
310-
]
311-
},
312-
{
313-
"url": null,
314-
"title": {"en": "Advanced Topics"},
315-
"target": null,
316-
"category": "doc_1.x",
317-
"type": "group",
318-
"isActive": true,
319-
"children": [
320-
{
321-
"url": {"en": "/docs/1.x/drafts-revisions"},
322-
"title": {"en": "Drafts & Revisions"},
302+
"url": {"en": "/docs/1.x/multilingual-content"},
303+
"title": {"en": "Multilingual Content"},
323304
"target": null,
324305
"category": "doc_1.x",
325306
"type": "link",
326307
"isActive": true,
327308
"children": []
328309
},
329310
{
330-
"url": {"en": "/docs/1.x/multilingual-content"},
331-
"title": {"en": "Multilingual Content"},
311+
"url": {"en": "/docs/1.x/middleware"},
312+
"title": {"en": "Middleware"},
332313
"target": null,
333314
"category": "doc_1.x",
334315
"type": "link",
335316
"isActive": true,
336317
"children": []
337318
},
338319
{
339-
"url": {"en": "/docs/1.x/customization"},
340-
"title": {"en": "Customization"},
320+
"url": {"en": "/docs/1.x/event-listeners"},
321+
"title": {"en": "Event Listeners"},
341322
"target": null,
342323
"category": "doc_1.x",
343324
"type": "link",
Lines changed: 76 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
2-
title: Drafts Revisions
3-
slug: drafts-revisions
4-
path: docs/v1/drafts-revisions
5-
uri: /docs/1.x/drafts-revisions
2+
title: Content Drafts & Revisions
3+
slug: content-drafts-revisions
4+
path: docs/v1/content-drafts-revisions
5+
uri: /docs/1.x/content-drafts-revisions
66
---
7-
# Drafts & Revisions
87

9-
InspireCMS provides a powerful content versioning system that allows you to work with drafts and track revisions of your content. This guide explains how to use these features to manage your content workflow effectively.
8+
# Content Drafts & Revisions
9+
10+
InspireCMS provides a content versioning system that allows you to work with drafts and track revisions of your content. This guide explains how to use these features to manage your content workflow effectively.
1011

1112
---
1213

@@ -38,9 +39,9 @@ Drafts are visible only in the admin panel and not on your live site.
3839

3940
Drafts are clearly marked in the content list:
4041

41-
- Status indicator shows "Draft"
42-
- Often color-coded differently from published content
43-
- Show an editing icon
42+
- Status indicator shows "Draft"
43+
- Often color-coded differently from published content
44+
- Show an editing icon
4445

4546
### Editing Drafts
4647

@@ -162,57 +163,71 @@ For organizations that require approval before publishing:
162163
A basic approval workflow can be set up using custom states and notifications:
163164

164165
```php {title="app/Providers/AppServiceProvider.php"}
165-
use SolutionForest\InspireCms\Facades\ContentStatusManifest;
166-
use SolutionForest\InspireCms\DataTypes\Manifest\ContentStatusOption;
167166
use Filament\Actions\Action;
167+
use SolutionForest\InspireCms\DataTypes\Manifest\ContentStatusOption;
168+
use SolutionForest\InspireCms\Facades\ContentStatusManifest;
169+
use SolutionForest\InspireCms\Helpers\ContentHelper;
168170

169171
// In your service provider
170172
public function boot()
171173
{
172174
// Add "In Review" status
173175
ContentStatusManifest::addOption(
174176
new ContentStatusOption(
175-
value: 2,
177+
value: 2, // Raw db value
176178
name: 'in_review',
177179
formAction: fn () => Action::make('submit_for_review')
178180
->authorize('inReview')
179181
->successNotificationTitle('Send to Review')
180-
->action(function ($record, $action) {
182+
->action(function ($record, $action, $livewire) {
181183
$if (is_null($record)) {
182184
$action->cancel();
183185

184186
return;
185187
}
186-
188+
187189
$publishableState = 'in_review';
188190

189-
if (! \SolutionForest\InspireCms\Helpers\ContentHelper::handlePublishableRecord($record, $publishableState, $livewire, [])) {
191+
if (! ContentHelper::handlePublishableRecord($record, $publishableState, $livewire, [])) {
190192
return;
191193
}
192194

193195
$action->success();
194-
})
196+
})
195197
)
196198
);
197-
}
198-
```
199-
200-
### Customizing Models and Authorization Policies
201-
202-
To fully implement a review workflow, you may need to extend the default content model and define authorization policies:
199+
// Add "Approved" status
200+
ContentStatusManifest::addOption(
201+
new ContentStatusOption(
202+
value: 5, // Raw db value
203+
name: 'approved',
204+
formAction: fn () => Action::make('approved')
205+
->authorize('approved')
206+
->successNotificationTitle('Approved')
207+
->action(function ($record, $action, $livewire) {
208+
$if (is_null($record)) {
209+
$action->cancel();
203210

204-
#### Custom Content Model
211+
return;
212+
}
205213

206-
```php
207-
namespace App\Models;
214+
$publishableState = 'approved';
208215

209-
use SolutionForest\InspireCms\Models\Content as BaseContent;
216+
if (! ContentHelper::handlePublishableRecord($record, $publishableState, $livewire, [])) {
217+
return;
218+
}
210219

211-
class Content extends BaseContent
212-
{
220+
$action->success();
221+
})
222+
)
223+
);
213224
}
214225
```
215226

227+
### Customizing Models and Authorization Policies
228+
229+
To fully implement a review workflow, you may need to extend the default content model and define authorization policies:
230+
216231
#### Custom Content Policy
217232

218233
```php
@@ -228,36 +243,36 @@ class ContentPolicy extends BasePolicy
228243
{
229244
return true;
230245
}
231-
246+
232247
public function view(User $user, Content $content): bool
233248
{
234249
return true;
235250
}
236-
251+
237252
public function create(User $user): bool
238253
{
239254
return $user->hasAnyRole(['author', 'editor', 'admin']);
240255
}
241-
256+
242257
public function update(User $user, Content $content): bool
243258
{
244259
// Authors can only edit drafts they created
245260
if ($user->hasRole('author') && $content->user_id === $user->id) {
246261
return $content?->display_status?->getName() === 'draft';
247262
}
248-
263+
249264
// Editors can review content in review status and edit any draft
250265
if ($user->hasRole('editor')) {
251266
return in_array($content?->display_status?->getName(), [
252267
'draft',
253268
'in_review',
254269
]);
255270
}
256-
271+
257272
// Admins can edit anything
258273
return $user->hasRole('admin');
259274
}
260-
275+
261276
public function publish(User $user, Content $content): bool
262277
{
263278
return $user->hasAnyRole(['editor', 'admin']);
@@ -267,6 +282,23 @@ class ContentPolicy extends BasePolicy
267282
{
268283
return $content?->display_status?->getName() !== 'in_review';
269284
}
285+
286+
public function approved(User $user, Content $content): bool
287+
{
288+
return $content?->display_status?->getName() === 'in_review';
289+
}
290+
}
291+
```
292+
293+
#### Custom Content Model
294+
295+
```php
296+
namespace App\Models;
297+
298+
use SolutionForest\InspireCms\Models\Content as BaseContent;
299+
300+
class Content extends BaseContent
301+
{
270302
}
271303
```
272304

@@ -317,18 +349,18 @@ When conflicting edits occur:
317349
1. The system detects when two users have edited the same content
318350
2. On save, the second user is shown a conflict resolution screen
319351
3. They can choose to:
320-
- Merge changes manually
321-
- Keep their version (overwrite)
322-
- Discard their changes
323-
- Save as a new draft
352+
- Merge changes manually
353+
- Keep their version (overwrite)
354+
- Discard their changes
355+
- Save as a new draft
324356

325357
---
326358

327359
## Best Practices
328360

329-
- **Regular Saves**: Save your work frequently to create revision points
330-
- **Meaningful Comments**: Add descriptive comments when making significant changes
331-
- **Test Before Publishing**: Always preview your content before publishing
332-
- **Schedule Major Updates**: Use scheduling for significant changes to go live during off-peak hours
333-
- **Limit Draft Duration**: Try not to keep drafts unpublished for extended periods to avoid outdated content
334-
- **Regular Cleanup**: Periodically review and remove unnecessary drafts and revisions
361+
- **Regular Saves**: Save your work frequently to create revision points
362+
- **Meaningful Comments**: Add descriptive comments when making significant changes
363+
- **Test Before Publishing**: Always preview your content before publishing
364+
- **Schedule Major Updates**: Use scheduling for significant changes to go live during off-peak hours
365+
- **Limit Draft Duration**: Try not to keep drafts unpublished for extended periods to avoid outdated content
366+
- **Regular Cleanup**: Periodically review and remove unnecessary drafts and revisions

0 commit comments

Comments
 (0)