Skip to content

Commit 0ba4f52

Browse files
committed
refactor(sharebymail): migrate app to Vue 3
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 3c1e9cd commit 0ba4f52

File tree

8 files changed

+32
-31
lines changed

8 files changed

+32
-31
lines changed

REUSE.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ SPDX-FileCopyrightText = "2020 Nextcloud GmbH and Nextcloud contributors"
178178
SPDX-License-Identifier = "AGPL-3.0-or-later"
179179

180180
[[annotations]]
181-
path = ["cypress/tsconfig.json", "cypress/fixtures/appstore/apps.json", "dist/icons.css"]
181+
path = ["cypress/tsconfig.json", "cypress/fixtures/appstore/apps.json", "dist/*.css"]
182182
precedence = "aggregate"
183183
SPDX-FileCopyrightText = "2022 Nextcloud GmbH and Nextcloud contributors"
184184
SPDX-License-Identifier = "AGPL-3.0-or-later"

apps/sharebymail/lib/Settings/Admin.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public function getForm() {
2626
$this->initialState->provideInitialState('sendPasswordMail', $this->settingsManager->sendPasswordByMail());
2727
$this->initialState->provideInitialState('replyToInitiator', $this->settingsManager->replyToInitiator());
2828

29+
\OCP\Util::addStyle('sharebymail', 'admin-settings');
30+
\OCP\Util::addScript('sharebymail', 'admin-settings');
2931
return new TemplateResponse('sharebymail', 'settings-admin', [], '');
3032
}
3133

apps/sharebymail/src/components/AdminSettings.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@
77
<NcSettingsSection
88
:name="t('sharebymail', 'Share by mail')"
99
:description="t('sharebymail', 'Allows people to share a personalized link to a file or folder by putting in an email address.')">
10-
<NcCheckboxRadioSwitch
11-
type="switch"
12-
:checked.sync="sendPasswordMail"
13-
@update:checked="update('sendpasswordmail', sendPasswordMail)">
10+
<NcCheckboxRadioSwitch v-model="sendPasswordMail" type="switch">
1411
{{ t('sharebymail', 'Send password by mail') }}
1512
</NcCheckboxRadioSwitch>
1613

17-
<NcCheckboxRadioSwitch
18-
type="switch"
19-
:checked.sync="replyToInitiator"
20-
@update:checked="update('replyToInitiator', replyToInitiator)">
14+
<NcCheckboxRadioSwitch v-model="replyToInitiator" type="switch">
2115
{{ t('sharebymail', 'Reply to initiator') }}
2216
</NcCheckboxRadioSwitch>
2317
</NcSettingsSection>
@@ -27,6 +21,7 @@
2721
import axios from '@nextcloud/axios'
2822
import { showError } from '@nextcloud/dialogs'
2923
import { loadState } from '@nextcloud/initial-state'
24+
import { t } from '@nextcloud/l10n'
3025
import { confirmPassword } from '@nextcloud/password-confirmation'
3126
import { generateOcsUrl } from '@nextcloud/router'
3227
import NcCheckboxRadioSwitch from '@nextcloud/vue/components/NcCheckboxRadioSwitch'
@@ -40,13 +35,27 @@ export default {
4035
NcSettingsSection,
4136
},
4237
38+
setup() {
39+
return { t }
40+
},
41+
4342
data() {
4443
return {
4544
sendPasswordMail: loadState('sharebymail', 'sendPasswordMail'),
4645
replyToInitiator: loadState('sharebymail', 'replyToInitiator'),
4746
}
4847
},
4948
49+
watch: {
50+
sendPasswordMail(newValue) {
51+
this.update('sendpasswordmail', newValue)
52+
},
53+
54+
replyToInitiator(newValue) {
55+
this.update('replyToInitiator', newValue)
56+
},
57+
},
58+
5059
methods: {
5160
async update(key, value) {
5261
await confirmPassword()

apps/sharebymail/src/main-admin.js

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
6+
import { createApp } from 'vue'
7+
import AdminSettings from './components/AdminSettings.vue'
8+
9+
const app = createApp(AdminSettings)
10+
app.mount('#vue-admin-sharebymail')

apps/sharebymail/templates/settings-admin.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
44
* SPDX-License-Identifier: AGPL-3.0-or-later
55
*/
6-
7-
\OCP\Util::addScript('sharebymail', 'vue-settings-admin-sharebymail');
86
?>
7+
98
<div id="vue-admin-sharebymail"></div>

build/frontend/vite.config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { createAppConfig } from '@nextcloud/vite-config'
77
import { resolve } from 'node:path'
88

99
export default createAppConfig({
10+
'admin-settings': resolve(import.meta.dirname, 'apps/sharebymail/src', 'settings-admin.ts'),
1011
}, {
1112
emptyOutputDirectory: {
1213
additionalDirectories: [resolve(import.meta.dirname, '../..', 'dist')],

0 commit comments

Comments
 (0)