diff --git a/src/components/Collective/CollectiveActions.vue b/src/components/Collective/CollectiveActions.vue index 6757db791..6c19d46cd 100644 --- a/src/components/Collective/CollectiveActions.vue +++ b/src/components/Collective/CollectiveActions.vue @@ -50,7 +50,7 @@ + target="ncCollectivesPrint"> {{ t('collectives', 'Export or print') }} -
+
@@ -71,6 +71,7 @@ export default { computed: { ...mapGetters([ 'currentCollective', + 'currentPage', 'pagesTreeWalk', 'shareTokenParam', ]), @@ -98,6 +99,14 @@ export default { return parts.join(' - ') }, + + /** + * List of all pages, empty if pages not loaded + */ + pages() { + if (!this.currentPage) return [] + return this.pagesTreeWalk(this.currentPage.parentId) + }, }, mounted() { @@ -110,12 +119,12 @@ export default { }), /** - * Get list of all pages + * Fetch list of all pages */ async getPages() { await this.dispatchGetPages() .catch(displayError('Could not fetch pages')) - this.loadPages.total = this.pagesTreeWalk().length + this.loadPages.total = this.pagesTreeWalk(this.currentPage.parentId).length }, ready(pageId) { diff --git a/src/components/Page/PageActionMenu.vue b/src/components/Page/PageActionMenu.vue index 8afe179a3..46f40c08c 100644 --- a/src/components/Page/PageActionMenu.vue +++ b/src/components/Page/PageActionMenu.vue @@ -68,6 +68,14 @@ {{ deletePageString }} + + {{ t('collectives', 'Export or print') }} + + @@ -85,6 +93,7 @@ import { NcActions, NcActionButton, NcActionLink, NcActionSeparator } from '@nex import isMobile from '@nextcloud/vue/dist/Mixins/isMobile.js' import CollectiveActions from '../Collective/CollectiveActions.vue' import DeleteIcon from 'vue-material-design-icons/Delete.vue' +import DownloadIcon from 'vue-material-design-icons/Download.vue' import EmoticonOutlineIcon from 'vue-material-design-icons/EmoticonOutline.vue' import FormatListBulletedIcon from 'vue-material-design-icons/FormatListBulleted.vue' import OpenInNewIcon from 'vue-material-design-icons/OpenInNew.vue' @@ -104,6 +113,7 @@ export default { NcActionLink, NcActionSeparator, DeleteIcon, + DownloadIcon, EmoticonOutlineIcon, FormatListBulletedIcon, PagesTemplateIcon, @@ -172,11 +182,17 @@ export default { 'hasSubpages', 'loading', 'pagesTreeWalk', + 'pageById', + 'pagePrintLink', 'showing', 'showTemplates', 'visibleSubpages', ]), + printLink() { + return this.pagePrintLink(this.pageById(this.pageId)) + }, + toggleOutlineString() { return this.showing('outline') ? t('collectives', 'Hide outline') diff --git a/src/components/PagePrint.vue b/src/components/PagePrint.vue index 0217cfd3b..db0d381f4 100644 --- a/src/components/PagePrint.vue +++ b/src/components/PagePrint.vue @@ -3,7 +3,7 @@

{{ currentCollectiveTitle }}

-

+

{{ pageTitleString }}

route.params, + children: [{ path: ':page*' }], }, { path: '/p/:token/print/:collective', component: CollectivePrintView, props: (route) => route.params, + children: [{ path: ':page*' }], }, { path: '/p/:token/:collective', diff --git a/src/store/pages.js b/src/store/pages.js index 07aeb7ce7..3eba7b9f1 100644 --- a/src/store/pages.js +++ b/src/store/pages.js @@ -171,6 +171,14 @@ export default { return state.pages.find(p => (p.parentId === parentId && p.title === TEMPLATE_PAGE)) }, + pagePrintLink: (state, get) => (page) => { + const path = [page.collectivePath.split('/').at(-1), page.filePath.split('/'), page.fileName] + if (path.at(-1) === 'Readme.md') path.splice(-1, 1) + if (get.isPublic) path.splice(2, 0, 'print') + else path.splice(0, 0, '_', 'print') + return generateUrl(`/apps/collectives/${path.join('/')}`) + }, + currentFileIdPage(state, _getters, rootState) { const fileId = Number(rootState.route.query.fileId) return state.pages.find(p => (p.id === fileId)) diff --git a/src/views/CollectivePrintView.vue b/src/views/CollectivePrintView.vue index fbffb1217..11c17d830 100644 --- a/src/views/CollectivePrintView.vue +++ b/src/views/CollectivePrintView.vue @@ -47,6 +47,15 @@ export default { height: fit-content; } + html, body { + background: var(--color-main-background, white)!important; + } + + /* hide toast notifications for printing */ + .toastify.dialogs { + display: none; + } + #content-vue { position: static; overflow: visible; diff --git a/src/views/CollectiveView.vue b/src/views/CollectiveView.vue index 11a0c7287..5927bd427 100644 --- a/src/views/CollectiveView.vue +++ b/src/views/CollectiveView.vue @@ -19,7 +19,9 @@