Skip to content

Commit b60f041

Browse files
committed
fix: fix bulk actions and correct translations support
1 parent 7324b1e commit b60f041

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

adminforth/spa/src/utils/listUtils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { callAdminForthApi } from '@/utils';
33
import { type AdminForthResourceFrontend } from '../types/Common';
44
import { useAdminforth } from '@/adminforth';
55
import { showErrorTost } from '@/composables/useFrontendApi'
6-
import { useI18n } from 'vue-i18n';
76

87
let getResourceDataLastAbortController: AbortController | null = null;
98
export async function getList(resource: AdminForthResourceFrontend, isPageLoaded: boolean, page: number | null , pageSize: number, sort: any, checkboxes:{ value: any[] }, filters: any = [] ) {
@@ -55,15 +54,14 @@ export async function getList(resource: AdminForthResourceFrontend, isPageLoaded
5554

5655

5756
export async function startBulkAction(actionId: string, resource: AdminForthResourceFrontend, checkboxes: { value: any[] },
58-
bulkActionLoadingStates: {value: Record<string, boolean>}, getListInner: () => Promise<any>) {
57+
bulkActionLoadingStates: {value: Record<string, boolean>}, getListInner: () => Promise<any>, t: (key: string, vars?: Record<string, any>) => string) {
5958
const action = resource?.options?.bulkActions?.find(a => a.id === actionId);
6059
const { confirm, alert } = useAdminforth();
61-
const { t } = useI18n();
6260

6361
if (action?.confirm) {
6462
const confirmed = await confirm({
6563
title: action.confirm,
66-
message: t(`Deleting ${checkboxes.value.length} ${checkboxes.value.length === 1 ? 'item' : 'items'}. This process is irreversible.`),
64+
message: `${t('Deleting')} ${checkboxes.value.length} ${checkboxes.value.length === 1 ? t('item') : t('items')}. ${t('This process is irreversible.')}`,
6765
});
6866
if (!confirmed) {
6967
return;

adminforth/spa/src/views/ListView.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ const filtersShow = ref(false);
248248
const { list, alert } = useAdminforth();
249249
const coreStore = useCoreStore();
250250
const filtersStore = useFiltersStore();
251+
const { t } = useI18n();
251252
252253
const route = useRoute();
253254
@@ -331,7 +332,7 @@ async function refreshExistingList(pk?: any) {
331332
}
332333
333334
async function startBulkActionInner(actionId: string) {
334-
await startBulkAction(actionId, coreStore.resource!, checkboxes, bulkActionLoadingStates, getListInner);
335+
await startBulkAction(actionId, coreStore.resource!, checkboxes, bulkActionLoadingStates, getListInner, t);
335336
}
336337
337338
async function startCustomBulkActionInner(actionId: string | number) {

0 commit comments

Comments
 (0)