From 66a7a89898678f30118151733be42ce041f55816 Mon Sep 17 00:00:00 2001
From: Carl Schwan
Date: Mon, 12 Sep 2022 22:58:53 +0200
Subject: Add api to load additional section in profile page
Signed-off-by: Carl Schwan
---
core/src/profile.js | 14 ++++++++++--
core/src/profile/ProfileSections.js | 43 +++++++++++++++++++++++++++++++++++++
core/src/views/Profile.vue | 11 +++++++++-
3 files changed, 65 insertions(+), 3 deletions(-)
create mode 100644 core/src/profile/ProfileSections.js
(limited to 'core/src')
diff --git a/core/src/profile.js b/core/src/profile.js
index 5e3711841a6..79465c6a28d 100644
--- a/core/src/profile.js
+++ b/core/src/profile.js
@@ -25,12 +25,22 @@ import { getRequestToken } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'
import VTooltip from 'v-tooltip'
-import logger from './logger'
+import logger from './logger.js'
-import Profile from './views/Profile'
+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({
diff --git a/core/src/profile/ProfileSections.js b/core/src/profile/ProfileSections.js
new file mode 100644
index 00000000000..4091c8332d6
--- /dev/null
+++ b/core/src/profile/ProfileSections.js
@@ -0,0 +1,43 @@
+
+/**
+ * @copyright Copyright (c) 2019 Julius Härtl
+ *
+ * @author Julius Härtl
+ *
+ * @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 .
+ *
+ */
+
+export default class ProfileSections {
+
+ _sections
+
+ constructor() {
+ this._sections = []
+ }
+
+ /**
+ * @param {registerSectionCallback} section To be called to mount the section to the profile page
+ */
+ registerSection(section) {
+ this._sections.push(section)
+ }
+
+ getSections() {
+ return this._sections
+ }
+
+}
diff --git a/core/src/views/Profile.vue b/core/src/views/Profile.vue
index 93b8316e4da..c7571fff148 100644
--- a/core/src/views/Profile.vue
+++ b/core/src/views/Profile.vue
@@ -118,13 +118,21 @@
-
+
{{ headline }}
+
+
+
+
+
@@ -204,6 +212,7 @@ export default {
biography,
actions,
isUserAvatarVisible,
+ sections: OCA.Core.ProfileSections.getSections(),
}
},
--
cgit v1.2.3