Skip to content

Commit 2a19fc7

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents 7865c95 + bb738ed commit 2a19fc7

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

adminforth/documentation/docs/tutorial/07-Plugins/19-user-soft-delete.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,37 @@ import UserSoftDelete from "@adminforth/user-soft-delete";
4444
columns[
4545

4646
...
47-
47+
//diff-add
4848
{
49+
//diff-add
4950
name: "is_active",
51+
//diff-add
5052
type: AdminForthDataTypes.BOOLEAN,
53+
//diff-add
5154
label: "Is Active",
55+
//diff-add
5256
fillOnCreate: () => true,
57+
//diff-add
5358
filterOptions: {
59+
//diff-add
5460
multiselect: false,
61+
//diff-add
5562
},
63+
//diff-add
5664
showIn: {
65+
//diff-add
5766
list: true,
67+
//diff-add
5868
filter: true,
69+
//diff-add
5970
show: true,
71+
//diff-add
6072
create: false,
73+
//diff-add
6174
edit: true,
75+
//diff-add
6276
},
77+
//diff-add
6378
},
6479

6580
...
@@ -71,16 +86,25 @@ columns[
7186
plugins: [
7287

7388
...
74-
89+
//diff-add
7590
new UserSoftDelete({
91+
//diff-add
7692
activeFieldName: "is_active",
93+
//diff-add
7794
//in canDeactivate we pass a function, that specify adminusers roles, which can seactivate other adminusers
95+
//diff-add
7896
canDeactivate: async (adminUser: AdminUser) => {
97+
//diff-add
7998
if (adminUser.dbUser.role === "superadmin") {
99+
//diff-add
80100
return true;
101+
//diff-add
81102
}
103+
//diff-add
82104
return false;
105+
//diff-add
83106
}
107+
//diff-add
84108
}),
85109

86110
...

adminforth/modules/restApi.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,20 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
405405
if (menuItem.children) {
406406
menuItem.children.forEach(processItem);
407407
}
408+
if (menuItem.pageLabel) {
409+
translateRoutines.push(
410+
(async () => {
411+
menuItem.pageLabel = await tr(menuItem.pageLabel, `UserMenu.${menuItem.pageLabel}`);
412+
})()
413+
);
414+
}
408415
}
409416
newMenu.forEach((menuItem) => {
410417
processItem(menuItem);
411418
});
419+
this.adminforth.config.auth.userMenuSettingsPages.forEach((page) => {
420+
processItem(page);
421+
});
412422
await Promise.all(translateRoutines);
413423

414424
// strip all backendOnly fields or not described in adminForth fields from dbUser

adminforth/spa/src/components/AcceptModal.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<Teleport to="body">
3-
<div ref="modalEl" tabindex="-1" aria-hidden="true" class="hidden fixed inset-0 z-50 w-full h-full overflow-y-auto overflow-x-hidden flex items-center justify-center">
3+
<div ref="modalEl" tabindex="-1" aria-hidden="true" class="hidden fixed inset-0 z-[110] w-full h-full overflow-y-auto overflow-x-hidden flex items-center justify-center">
44
<div class="relative p-4 w-full max-w-md max-h-full" >
55
<div class="afcl-confirmation-container relative bg-lightAcceptModalBackground rounded-lg shadow dark:bg-darkAcceptModalBackground dark:shadow-black">
66
<button type="button" @click="modalStore.togleModal" class="absolute top-3 end-2.5 text-lightAcceptModalCloseIcon bg-transparent hover:bg-lightAcceptModalCloseIconHoverBackground hover:text-lightAcceptModalCloseIconHover rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:text-darkAcceptModalCloseIcon dark:hover:bg-darkAcceptModalCloseIconHoverBackground dark:hover:text-darkAcceptModalCloseIconHover" >
@@ -51,6 +51,7 @@ onMounted(async () => {
5151
{
5252
closable: true,
5353
backdrop: 'static',
54+
backdropClasses: "bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-[100]"
5455
}
5556
);
5657
})

adminforth/spa/src/components/UserMenuSettingsButton.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
w-full select-none "
88
@click="showDropdown = !showDropdown"
99
>
10-
<span>Settings</span>
10+
<span>{{ $t('Settings') }}</span>
1111
<IconCaretDownSolid class="h-5 w-5 text-lightPrimary dark:text-gray-400 opacity-50 transition duration-150 ease-in"
1212
:class="{ 'transform rotate-180': showDropdown }"
1313
/>
@@ -40,9 +40,11 @@ import { computed, ref, onMounted, watch } from 'vue';
4040
import { useCoreStore } from '@/stores/core';
4141
import { getIcon } from '@/utils';
4242
import { useRouter } from 'vue-router';
43+
import { useI18n } from 'vue-i18n';
4344
4445
const router = useRouter();
4546
const coreStore = useCoreStore();
47+
const { t } = useI18n();
4648
4749
const showDropdown = ref(false);
4850
const props = defineProps(['meta', 'resource']);

adminforth/spa/src/views/SettingsView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="mt-20 h-full w-full" :class="{ 'hidden': initialTabSet === false }">
33
<div v-if="!coreStore?.config?.settingPages || coreStore?.config?.settingPages.length === 0">
4-
<p>No setting pages configured or still loading...</p>
4+
<p>{{ $t('No setting pages configured or still loading...') }}</p>
55
</div>
66
<VerticalTabs v-else ref="VerticalTabsRef" v-model:active-tab="activeTab" @update:active-tab="setURL({slug: $event, pageLabel: ''})">
77
<template v-for="(c,i) in coreStore?.config?.settingPages" :key="`tab:${settingPageSlotName(c,i)}`" v-slot:['tab:'+c.slug]>

0 commit comments

Comments
 (0)