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
> - `'none'`: Renders the page without AdminForth's default sidebar and header layout - perfect for standalone pages like setup wizards, or public (logged-out) pages (Terms-of-Service/PP/Contact form etc)
456
+
> - `'default'`: Uses the full AdminForth layout with sidebar and header - ideal for pages that should feel integrated with the admin panel
457
+
> - `'preferIconOnly'`: Uses the default layout but starts with a collapsed sidebar (even if icon-only sidebar is disabled in your configuration) - great for pages that need more screen space or already have some navigation
458
+
453
459
This will register custom page with path `/setup2fa` and will not include it in the menu.
454
460
455
461
You can navigate user to this page using any router link, e.g.:
@@ -466,13 +472,13 @@ Add to your `<script setup>` section:
466
472
import { Link } from'@/afcl';
467
473
```
468
474
469
-
If you set `customLayout:true` in the `meta` object, it will not include default layout like sidebar and header, so you can create your own layout for this page.
475
+
If you set `sidebarAndHeader:'none'` in the `meta` object, it will not include default layout like sidebar and header, so you can create your own layout for this page.
470
476
471
477
### Disable redirects to login page (Public pages)
472
478
473
479
Any route which has sidebar and header (e.g. default CRUD pages or menu item with `component`) uses internal AdminForth REST API to fetch menu items and user information, so it passes authentication check and if authentication cookie is not provided or has expired JWT user gets redirected to the login page.
474
480
475
-
In case if you set `customLayout:true`, it will not call these APIs so user will not be automatically redirected to the login page in case of expired or not-provided authentication cookie. That feature allows you to implement public pages without authentication, e.g. Terms of Service, Privacy Policy and many others. In case if you need to check if user is logged in just call any custom API which has `admin.express.authorize` middleware. Obviously for public pages if they use any APIs you should create API endpoint WITHOUT `admin.express.authorize` middleware.
481
+
In case if you set `sidebarAndHeader:'none'`, it will not call these APIs so user will not be automatically redirected to the login page in case of expired or not-provided authentication cookie. That feature allows you to implement public pages without authentication, e.g. Terms of Service, Privacy Policy and many others. In case if you need to check if user is logged in just call any custom API which has `admin.express.authorize` middleware. Obviously for public pages if they use any APIs you should create API endpoint WITHOUT `admin.express.authorize` middleware.
476
482
477
483
> Please note that AdminForth uses classic SPA Vue app, so even public pages will be rendered by JavaScript in the browser and not on the server side. If your public page should be indexed by search engines, you should use some SSR framework like Nuxt.js to create such pages. At the same time public pages can still be usefull if you don't focus on old-fashioned search engines (modern search engines can index SPA pages as well) or if indexing is not important for such pages at all (e.g. Terms of Service, Privacy Policy, Contact Us and many others).
478
484
@@ -491,7 +497,7 @@ You can add custom meta attributes to the page by passing `meta` object to the p
491
497
file:'@@/pages/TwoFactorsSetup.vue',
492
498
meta: {
493
499
title:'Setup 2FA', // meta title for this page
494
-
customLayout:true,// don't include default layout like menu/header
500
+
sidebarAndHeader:'none', // don't include default layout like menu/header
495
501
//diff-add
496
502
myAttribute:'a1'
497
503
}
@@ -508,4 +514,56 @@ import { useRoute } from 'vue-router';
508
514
constroute=useRoute();
509
515
510
516
console.log(route.meta.myAttribute); // a1
511
-
```
517
+
```
518
+
519
+
## Settings View
520
+
521
+
If you want to add a Settings section to your project:
522
+
523
+
```ts title='./index.ts'
524
+
exportconstadmin=newAdminForth({
525
+
baseUrl :ADMIN_BASE_URL,
526
+
auth: {
527
+
//diff-add
528
+
userMenuSettingsPages: [
529
+
//diff-add
530
+
{
531
+
//diff-add
532
+
pageLabel:'Profile settings',
533
+
//diff-add
534
+
component:'@@/ProfileSettings.vue',
535
+
//diff-add
536
+
// Specify a slug if you want a custom URL path.
537
+
//diff-add
538
+
// For example, without a slug, the URL will be:
539
+
//diff-add
540
+
// example.com/settings/profile-settings
541
+
//diff-add
542
+
// With a custom slug, you could have:
543
+
//diff-add
544
+
// example.com/settings/users-settings
545
+
//diff-add
546
+
slug:"users-settings",
547
+
//diff-add
548
+
icon:"flowbite:user-solid"
549
+
//diff-add
550
+
},
551
+
//diff-add
552
+
{
553
+
//diff-add
554
+
pageLabel:'Security',
555
+
//diff-add
556
+
component:"@@/MySecrets.vue",
557
+
//diff-add
558
+
icon:"flowbite:lock-solid"
559
+
//diff-add
560
+
}
561
+
//diff-add
562
+
],
563
+
}
564
+
});
565
+
```
566
+
567
+
After this, you will have a custom Settings section in the users menu:
description="Description text for large card. This is a large card. Very nice card. Big one. You can put here any content you want."
455
+
>
456
+
</Card>
457
+
458
+
<Card
459
+
size="md"
460
+
title="This is a medium card"
461
+
description="Description text for medium card. This is a medium card. Very nice card. Big one. You can put here any content you want."
462
+
>
463
+
</Card>
464
+
465
+
<Card
466
+
size="sm"
467
+
title="This is a small card"
468
+
description="Description text for small card. This is a small card. Very nice card. Big one. You can put here any content you want."
469
+
>
470
+
</Card>
471
+
```
472
+

473
+
474
+
</div>
365
475
366
476
## Toggle
367
477
@@ -858,10 +968,49 @@ async function loadPageData(data) {
858
968
//diff-add
859
969
:data="loadPageData"
860
970
861
-
:pageSize="3"> </Table>
971
+
:pageSize="3">
972
+
</Table>
862
973
```
863
974
> 👆 The page size is used as the limit for pagination.
864
975
976
+
### Table loading states
977
+
978
+
For tables where you load data externally and pass them to `data` prop as array (including case with front-end pagination) you might want to show skeleton loaders in table externaly using `isLoading` props.
979
+
980
+
For tables with server-side paganation which use async function in data prop you can listen for `@update:tableLoading` to get table internal loading state, in other words this event will let you know when server side function started and finished execution, so you might use it e.g. to disable some external filter buttons and so on.
0 commit comments