Skip to content

Commit 34c5442

Browse files
committed
Added mention about replacing a view
1 parent 5aa9c73 commit 34c5442

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

code_samples/back_office/subitems/timeline_view/registerTimelineView.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import TimelineViewComponent from './timeline.view.component.js';
22
import { registerView } from '@ibexa-admin-ui-modules/sub-items/services/view.registry';
33

4+
// Use the existing constants to replace a view
5+
import { VIEW_MODE_GRID, VIEW_MODE_TABLE } from '@ibexa-admin-ui-modules/sub-items/constants';
6+
47
registerView('timeline', {
58
component: TimelineViewComponent,
69
iconName: 'timeline',

docs/administration/back_office/subitems_list.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ description: Inject a sub-items list into your back office customizations or cus
77
The Sub-items List module is meant to be used as a part of the editorial interface of [[= product_name =]].
88
It provides an interface for listing the sub-items of any location.
99

10-
## Add custom sub-items list view
10+
## Create custom sub-items list view
1111

12-
You can extend the Sub-items List module to add your own views to it.
13-
The example below uses a timeline view to highlight the modification date.
12+
You can extend the Sub-items List module to replace an existing view or add your own.
13+
The example below adds a new timeline view to highlight the modification date.
1414

1515
![Sub-items List module using the new Timeline view](img/subitems/timeline_view.png "Sub-items List module using the new Timeline view")
1616

@@ -37,6 +37,12 @@ Provide the necessary styling in `assets/scss/timeline.view.scss`. The example b
3737

3838
The last step is adding the view module to the list of available views in the system, by using the provided `registerView` function.
3939

40+
You can create a new view by providing an unique identifier, or replace an existing one by reusing its identifier.
41+
The existing view identifiers are defined as JavaScript constants in the `@ibexa-admin-ui-modules/sub-items/constants` module:
42+
43+
- Grid view: `VIEW_MODE_GRID` constant
44+
- Table view: `VIEW_MODE_TABLE` constant
45+
4046
Create a file called `assets/js/registerTimelineView.js`:
4147

4248
``` js

0 commit comments

Comments
 (0)