6666 <Column :exportable =" false" >
6767 <template #body =" slotProps " >
6868 <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-
7569 <Button
7670 v-if =" securityStore.isAuthenticated"
7771 class =" p-button-icon-only p-button-plain p-button-outlined p-button-sm"
7872 icon =" mdi mdi-pencil"
7973 @click =" goToEditItem(slotProps.data)"
8074 />
81-
8275 <Button
8376 v-if =" securityStore.isAuthenticated"
8477 class =" p-button-icon-only p-button-danger p-button-outlined p-button-sm"
8578 icon =" mdi mdi-delete"
8679 @click =" confirmDeleteItem(slotProps.data)"
8780 />
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+ />
8888 </div >
8989 </template >
9090 </Column >
121121
122122 <template #footer >
123123 <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) "
128128 />
129+
129130 <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) "
134135 />
135136 </template >
136137 </Dialog >
198199 />
199200 </template >
200201 </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 >
201220</template >
202221
203222<script setup>
@@ -242,8 +261,6 @@ onMounted(() => {
242261})
243262
244263const items = computed (() => store .state [" page" ].recents )
245-
246- // const deletedPage = computed(() => store.state['page'].deleted);
247264const isLoading = computed (() => store .state [" page" ].isLoading )
248265const totalItems = computed (() => store .state [" page" ].totalItems )
249266
@@ -270,31 +287,6 @@ const sortingChanged = (event) => {
270287 onUpdateOptions (options .value )
271288}
272289
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-
298290const deleteMultipleItems = () => {
299291 console .log (" deleteMultipleItems" .selectedItems .value )
300292
@@ -311,31 +303,25 @@ const deleteMultipleItems = () => {
311303
312304 onUpdateOptions (options .value )
313305}
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-
325306const confirmDeleteItem = (itemToDelete ) => {
326307 item .value = itemToDelete
327308 deleteItemDialog .value = true
328309}
329310
330- /* const confirmDeleteMultiple = () => {
331- deleteMultipleDialog.value = true;
332- };*/
333-
334311const btnCofirmSingleDeleteOnClick = () => {
335312 deleteItem (item)
336313
337314 item .value = {}
338315
339316 deleteItemDialog .value = false
340317}
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+ }
341327 </script >
0 commit comments