From 949e09ccb734b23a09d70f79972aeb7e86bedda4 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sat, 23 Dec 2023 20:48:10 +0100 Subject: enh(core): Refactor profile page to use vue components Signed-off-by: Ferdinand Thiessen --- core/src/profile.js | 59 ------ core/src/profile.ts | 45 +++++ core/src/views/Profile.vue | 482 +++++++++++++++++---------------------------- 3 files changed, 227 insertions(+), 359 deletions(-) delete mode 100644 core/src/profile.js create mode 100644 core/src/profile.ts (limited to 'core/src') diff --git a/core/src/profile.js b/core/src/profile.js deleted file mode 100644 index 79465c6a28d..00000000000 --- a/core/src/profile.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @copyright 2021, Christopher Ng - * - * @author Christopher Ng - * - * @license AGPL-3.0-or-later - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -import Vue from 'vue' -import { getRequestToken } from '@nextcloud/auth' -import { translate as t } from '@nextcloud/l10n' -import VTooltip from 'v-tooltip' - -import logger from './logger.js' - -import Profile from './views/Profile.vue' -import ProfileSections from './profile/ProfileSections.js' - -__webpack_nonce__ = btoa(getRequestToken()) - -if (!window.OCA) { - window.OCA = {} -} - -if (!window.OCA.Core) { - window.OCA.Core = {} -} -Object.assign(window.OCA.Core, { ProfileSections: new ProfileSections() }) - -Vue.use(VTooltip) - -Vue.mixin({ - props: { - logger, - }, - methods: { - t, - }, -}) - -const View = Vue.extend(Profile) - -window.addEventListener('DOMContentLoaded', () => { - new View().$mount('#vue-profile') -}) diff --git a/core/src/profile.ts b/core/src/profile.ts new file mode 100644 index 00000000000..ee1593e8705 --- /dev/null +++ b/core/src/profile.ts @@ -0,0 +1,45 @@ +/** + * @copyright 2021, Christopher Ng + * + * @author Christopher Ng + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import { getRequestToken } from '@nextcloud/auth' +import Vue from 'vue' + +import Profile from './views/Profile.vue' +import ProfileSections from './profile/ProfileSections.js' + +// @ts-expect-error Script nonce required for webpack loading additional scripts +__webpack_nonce__ = btoa(getRequestToken() ?? '') + +if (!window.OCA) { + window.OCA = {} +} + +if (!window.OCA.Core) { + window.OCA.Core = {} +} +Object.assign(window.OCA.Core, { ProfileSections: new ProfileSections() }) + +const View = Vue.extend(Profile) + +window.addEventListener('DOMContentLoaded', () => { + new View().$mount('#content') +}) diff --git a/core/src/views/Profile.vue b/core/src/views/Profile.vue index 84859f4a971..b7f593df8d2 100644 --- a/core/src/views/Profile.vue +++ b/core/src/views/Profile.vue @@ -22,197 +22,185 @@ --> - - - -- cgit v1.2.3