You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 2, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: readme.md
+19-49Lines changed: 19 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,18 +6,13 @@ This package is ment to be used **INSTEAD** of overwriting the `custom-index-hea
6
6
7
7
## Usage
8
8
9
-
Let's say you want to add a custom button to the `toolbar` of all `index` views. Just create a vue component for it, as you would do if you use the `custom-index-header` (see section "Create custom component" if you don't know how to). Let's call it `my-index-toolbar-btn` Now the only thing you have to do is register it to your `\App\Ņova\Resource` class, within a new method called `customIndexToolbarComponents`:
9
+
Let's say you want to add a custom button to the `toolbar` of all `index` views. Just create a vue component for it, as you would do if you use the `custom-index-header` (see section "Create custom component" if you don't know how to). Let's call it `my-index-toolbar-btn`. Now the only thing you have to do is register it to your `\App\Ņova\Resource` class, within a new method called `customIndexToolbarComponents`, which returns a `\Bernhardh\NovaDynamicViews\CustomComponents` object:
10
10
11
11
```php
12
12
public function customIndexToolbarComponents()
13
13
{
14
-
return [
15
-
'items' => [
16
-
[
17
-
'name' => 'my-index-toolbar-btn',
18
-
],
19
-
]
20
-
];
14
+
return CustomComponents::make()
15
+
->addItem('my-index-toolbar-btn');
21
16
}
22
17
```
23
18
@@ -30,32 +25,22 @@ If you want to add extra data (for example a label) to your component (without e
30
25
```php
31
26
public function customIndexToolbarComponents()
32
27
{
33
-
return [
34
-
'items' => [
35
-
[
36
-
'name' => 'my-index-toolbar-btn',
37
-
'meta' => [
38
-
'label' => 'My label'
39
-
]
40
-
],
41
-
]
42
-
];
28
+
return CustomComponents::make()
29
+
->addItem('my-index-toolbar-btn', [
30
+
'label' => 'My label'
31
+
]);
43
32
}
44
33
```
45
34
46
35
### Add (tailwind) class to the container
47
36
48
-
If you want to add additional css classes to the container div of a section (for example add `flex w-full justify-end items-center mx-3` to the `customIndexToolbarComponents` section), add the `class`key:
37
+
If you want to add additional css classes to the container div of a section (for example add `flex w-full justify-end items-center mx-3` to the `customIndexToolbarComponents` section), add the `class`in the `make` function (or use the `setClass` method):
0 commit comments