diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-07-20 00:23:32 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-08-25 23:52:33 +0000 |
commit | dd7cb9784f5334b6057bfdb015ada39a35c1ddd9 (patch) | |
tree | 678a99d2619a41f0e682e54ac9f76d23aa5b32f1 /apps | |
parent | 38d0419f14ad70dbd82ef18946846b8ce3ea1682 (diff) | |
download | nextcloud-server-dd7cb9784f5334b6057bfdb015ada39a35c1ddd9.tar.gz nextcloud-server-dd7cb9784f5334b6057bfdb015ada39a35c1ddd9.zip |
Remake location property saving with Vue
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'apps')
6 files changed, 59 insertions, 19 deletions
diff --git a/apps/settings/js/federationsettingsview.js b/apps/settings/js/federationsettingsview.js index 1a823ce5521..547f05a57b6 100644 --- a/apps/settings/js/federationsettingsview.js +++ b/apps/settings/js/federationsettingsview.js @@ -131,7 +131,8 @@ field === 'avatar' || field === 'email' || field === 'displayname' || - field === 'twitter' + field === 'twitter' || + field === 'address' ) { return; } diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index df1608e01d9..2bdd53afcf6 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -149,8 +149,6 @@ class PersonalInfo implements ISettings { 'avatarScope' => $account->getProperty(IAccountManager::PROPERTY_AVATAR)->getScope(), 'phone' => $account->getProperty(IAccountManager::PROPERTY_PHONE)->getValue(), 'phoneScope' => $account->getProperty(IAccountManager::PROPERTY_PHONE)->getScope(), - 'address' => $account->getProperty(IAccountManager::PROPERTY_ADDRESS)->getValue(), - 'addressScope' => $account->getProperty(IAccountManager::PROPERTY_ADDRESS)->getScope(), 'website' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getValue(), 'websiteScope' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getScope(), 'websiteVerification' => $account->getProperty(IAccountManager::PROPERTY_WEBSITE)->getVerified(), @@ -162,8 +160,9 @@ class PersonalInfo implements ISettings { $personalInfoParameters = [ 'userId' => $uid, 'displayName' => $this->getProperty($account, IAccountManager::PROPERTY_DISPLAYNAME), - 'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER), 'emailMap' => $this->getEmailMap($account), + 'location' => $this->getProperty($account, IAccountManager::PROPERTY_ADDRESS), + 'twitter' => $this->getProperty($account, IAccountManager::PROPERTY_TWITTER), 'languageMap' => $this->getLanguageMap($user), 'profileEnabledGlobally' => $this->profileManager->isProfileEnabled(), 'profileEnabled' => $this->profileManager->isProfileEnabled($user), diff --git a/apps/settings/src/components/PersonalInfo/LocationSection.vue b/apps/settings/src/components/PersonalInfo/LocationSection.vue new file mode 100644 index 00000000000..e75075b6d1e --- /dev/null +++ b/apps/settings/src/components/PersonalInfo/LocationSection.vue @@ -0,0 +1,50 @@ +<!-- + - @copyright 2022 Christopher Ng <chrng8@gmail.com> + - + - @author Christopher Ng <chrng8@gmail.com> + - + - @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 <http://www.gnu.org/licenses/>. + - +--> + +<template> + <AccountPropertySection v-bind.sync="location" + :placeholder="t('settings', 'Your location')" /> +</template> + +<script> +import { loadState } from '@nextcloud/initial-state' + +import AccountPropertySection from './shared/AccountPropertySection.vue' + +import { NAME_READABLE_ENUM } from '../../constants/AccountPropertyConstants.js' + +const { location } = loadState('settings', 'personalInfoParameters', {}) + +export default { + name: 'LocationSection', + + components: { + AccountPropertySection, + }, + + data() { + return { + location: { ...location, readable: NAME_READABLE_ENUM[location.name] }, + } + }, +} +</script> diff --git a/apps/settings/src/constants/AccountPropertyConstants.js b/apps/settings/src/constants/AccountPropertyConstants.js index 17debe27c55..2f3a84b4908 100644 --- a/apps/settings/src/constants/AccountPropertyConstants.js +++ b/apps/settings/src/constants/AccountPropertyConstants.js @@ -46,7 +46,7 @@ export const ACCOUNT_PROPERTY_ENUM = Object.freeze({ /** Enum of account properties to human readable account property names */ export const ACCOUNT_PROPERTY_READABLE_ENUM = Object.freeze({ - ADDRESS: t('settings', 'Address'), + ADDRESS: t('settings', 'Location'), AVATAR: t('settings', 'Avatar'), BIOGRAPHY: t('settings', 'About'), DISPLAYNAME: t('settings', 'Full name'), diff --git a/apps/settings/src/main-personal-info.js b/apps/settings/src/main-personal-info.js index 1ebaae0fc8e..431c8b71d37 100644 --- a/apps/settings/src/main-personal-info.js +++ b/apps/settings/src/main-personal-info.js @@ -28,6 +28,7 @@ import '@nextcloud/dialogs/styles/toast.scss' import DisplayNameSection from './components/PersonalInfo/DisplayNameSection.vue' import EmailSection from './components/PersonalInfo/EmailSection/EmailSection.vue' +import LocationSection from './components/PersonalInfo/LocationSection.vue' import TwitterSection from './components/PersonalInfo/TwitterSection.vue' import LanguageSection from './components/PersonalInfo/LanguageSection/LanguageSection.vue' import ProfileSection from './components/PersonalInfo/ProfileSection/ProfileSection.vue' @@ -49,11 +50,13 @@ Vue.mixin({ const DisplayNameView = Vue.extend(DisplayNameSection) const EmailView = Vue.extend(EmailSection) +const LocationView = Vue.extend(LocationSection) const TwitterView = Vue.extend(TwitterSection) const LanguageView = Vue.extend(LanguageSection) new DisplayNameView().$mount('#vue-displayname-section') new EmailView().$mount('#vue-email-section') +new LocationView().$mount('#vue-location-section') new TwitterView().$mount('#vue-twitter-section') new LanguageView().$mount('#vue-language-section') diff --git a/apps/settings/templates/settings/personal/personal.info.php b/apps/settings/templates/settings/personal/personal.info.php index 973c98521f5..9fae83dc89d 100644 --- a/apps/settings/templates/settings/personal/personal.info.php +++ b/apps/settings/templates/settings/personal/personal.info.php @@ -136,20 +136,7 @@ script('settings', [ </form> </div> <div class="personal-settings-setting-box"> - <form id="addressform" class="section"> - <h3> - <label for="address"><?php p($l->t('Address')); ?></label> - <a href="#" class="federation-menu" aria-label="<?php p($l->t('Change privacy level of address')); ?>"> - <span class="icon-federation-menu icon-password"> - <span class="icon-triangle-s"></span> - </span> - </a> - </h3> - <input type="text" id="address" name="address" placeholder="<?php p($l->t('Your postal address')); ?>" value="<?php p($_['address']) ?>" autocomplete="on" autocapitalize="none" autocorrect="off" /> - <span class="icon-checkmark hidden"></span> - <span class="icon-error hidden"></span> - <input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>"> - </form> + <div id="vue-location-section"></div> </div> <div class="personal-settings-setting-box"> <form id="websiteform" class="section"> |