66
66
<Column :exportable =" false" >
67
67
<template #body =" slotProps " >
68
68
<div class =" text-right space-x-2" >
69
- <!-- <Button-->
70
- <!-- class="p-button-icon-only p-button-plain p-button-outlined p-button-sm"-->
71
- <!-- icon="mdi mdi-information"-->
72
- <!-- @click="showHandler(slotProps.data)"-->
73
- <!-- />-->
74
-
75
69
<Button
76
70
v-if =" securityStore.isAuthenticated"
77
71
class =" p-button-icon-only p-button-plain p-button-outlined p-button-sm"
78
72
icon =" mdi mdi-pencil"
79
73
@click =" goToEditItem(slotProps.data)"
80
74
/>
81
-
82
75
<Button
83
76
v-if =" securityStore.isAuthenticated"
84
77
class =" p-button-icon-only p-button-danger p-button-outlined p-button-sm"
85
78
icon =" mdi mdi-delete"
86
79
@click =" confirmDeleteItem(slotProps.data)"
87
80
/>
81
+ <Button
82
+ v-if =" slotProps.data.enabled && slotProps.data.slug"
83
+ class =" p-button-icon-only p-button-plain p-button-outlined p-button-sm"
84
+ icon =" mdi mdi-link-variant"
85
+ :title =" t('Show public link')"
86
+ @click =" showPublicLinkDialog(slotProps.data)"
87
+ />
88
88
</div >
89
89
</template >
90
90
</Column >
121
121
122
122
<template #footer >
123
123
<Button
124
- class = " p-button-text "
125
- icon = " pi pi-times "
126
- label = " Cancel "
127
- @click =" hideDialog "
124
+ v-if = " securityStore.isAuthenticated "
125
+ class = " p-button-icon-only p-button-plain p-button-outlined p-button-sm "
126
+ icon = " mdi mdi-pencil "
127
+ @click =" goToEditItem(slotProps.data) "
128
128
/>
129
+
129
130
<Button
130
- class = " p-button-text "
131
- icon = " pi pi-check "
132
- label = " Save "
133
- @click =" saveItem "
131
+ v-if = " securityStore.isAuthenticated "
132
+ class = " p-button-icon-only p-button-danger p-button-outlined p-button-sm "
133
+ icon = " mdi mdi-delete "
134
+ @click =" confirmDeleteItem(slotProps.data) "
134
135
/>
135
136
</template >
136
137
</Dialog >
198
199
/>
199
200
</template >
200
201
</Dialog >
202
+
203
+ <Dialog
204
+ v-model:visible =" publicLinkDialogVisible"
205
+ :header =" t('Public link')"
206
+ :modal =" true"
207
+ :style =" { width: '500px' }"
208
+ >
209
+ <div class =" text-center" >
210
+ <p class =" text-sm mb-2" >{{ t("You can share or copy this link:") }}</p >
211
+ <InputText
212
+ v-model =" publicLink"
213
+ readonly
214
+ class =" w-full mb-3 cursor-pointer"
215
+ @focus =" $event.target.select()"
216
+ />
217
+ <p class =" text-xs text-gray-500 italic" >{{ t("Select the link above and press Ctrl+C to copy it") }}</p >
218
+ </div >
219
+ </Dialog >
201
220
</template >
202
221
203
222
<script setup>
@@ -242,8 +261,6 @@ onMounted(() => {
242
261
})
243
262
244
263
const items = computed (() => store .state [" page" ].recents )
245
-
246
- // const deletedPage = computed(() => store.state['page'].deleted);
247
264
const isLoading = computed (() => store .state [" page" ].isLoading )
248
265
const totalItems = computed (() => store .state [" page" ].totalItems )
249
266
@@ -270,31 +287,6 @@ const sortingChanged = (event) => {
270
287
onUpdateOptions (options .value )
271
288
}
272
289
273
- /* const openNew = () => {
274
- item.value = {};
275
- submitted.value = false;
276
- itemDialog.value = true;
277
- };*/
278
-
279
- const saveItem = () => {
280
- submitted .value = true
281
-
282
- if (item .value .title .trim ()) {
283
- if (! item .value .id ) {
284
- // item.value.creator
285
- // createCategory.value(item.value);
286
- toast .add ({
287
- severity: " success" ,
288
- detail: t (" Saved" ),
289
- life: 3500 ,
290
- })
291
- }
292
-
293
- itemDialog .value = false
294
- item .value = {}
295
- }
296
- }
297
-
298
290
const deleteMultipleItems = () => {
299
291
console .log (" deleteMultipleItems" .selectedItems .value )
300
292
@@ -311,31 +303,25 @@ const deleteMultipleItems = () => {
311
303
312
304
onUpdateOptions (options .value )
313
305
}
314
-
315
- const hideDialog = () => {
316
- itemDialog .value = false
317
- submitted .value = false
318
- }
319
-
320
- /* const editItem = (item) => {
321
- item.value = { ...item };
322
- itemDialog.value = true;
323
- };*/
324
-
325
306
const confirmDeleteItem = (itemToDelete ) => {
326
307
item .value = itemToDelete
327
308
deleteItemDialog .value = true
328
309
}
329
310
330
- /* const confirmDeleteMultiple = () => {
331
- deleteMultipleDialog.value = true;
332
- };*/
333
-
334
311
const btnCofirmSingleDeleteOnClick = () => {
335
312
deleteItem (item)
336
313
337
314
item .value = {}
338
315
339
316
deleteItemDialog .value = false
340
317
}
318
+
319
+ const publicLinkDialogVisible = ref (false )
320
+ const publicLink = ref (" " )
321
+
322
+ const showPublicLinkDialog = (item ) => {
323
+ if (! item .slug ) return
324
+ publicLink .value = ` ${ window .location .origin } /pages/${ item .slug } `
325
+ publicLinkDialogVisible .value = true
326
+ }
341
327
</script >
0 commit comments