aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/settings_modal')
-rw-r--r--src/components/settings_modal/settings_modal_content.js28
-rw-r--r--src/components/settings_modal/settings_modal_content.vue9
2 files changed, 37 insertions, 0 deletions
diff --git a/src/components/settings_modal/settings_modal_content.js b/src/components/settings_modal/settings_modal_content.js
index 48101a90..ef1a5ffa 100644
--- a/src/components/settings_modal/settings_modal_content.js
+++ b/src/components/settings_modal/settings_modal_content.js
@@ -27,6 +27,34 @@ const SettingsModalContent = {
computed: {
isLoggedIn () {
return !!this.$store.state.users.currentUser
+ },
+ open () {
+ return this.$store.state.interface.settingsModalState !== 'hidden'
+ }
+ },
+ methods: {
+ onOpen () {
+ const targetTab = this.$store.state.interface.settingsModalTargetTab
+ // We're being told to open in specific tab
+ if (targetTab) {
+ const tabIndex = this.$refs.tabSwitcher.$slots.default.findIndex(elm => {
+ return elm.data && elm.data.attrs['data-tab-name'] === targetTab
+ })
+ if (tabIndex >= 0) {
+ this.$refs.tabSwitcher.setTab(tabIndex)
+ }
+ }
+ // Clear the state of target tab, so that next time settings is opened
+ // it doesn't force it.
+ this.$store.dispatch('clearSettingsModalTargetTab')
+ }
+ },
+ mounted () {
+ this.onOpen()
+ },
+ watch: {
+ open: function (value) {
+ if (value) this.onOpen()
}
}
}
diff --git a/src/components/settings_modal/settings_modal_content.vue b/src/components/settings_modal/settings_modal_content.vue
index 2156844f..bc30a0ff 100644
--- a/src/components/settings_modal/settings_modal_content.vue
+++ b/src/components/settings_modal/settings_modal_content.vue
@@ -8,6 +8,7 @@
<div
:label="$t('settings.general')"
icon="wrench"
+ data-tab-name="general"
>
<GeneralTab />
</div>
@@ -15,6 +16,7 @@
v-if="isLoggedIn"
:label="$t('settings.profile_tab')"
icon="user"
+ data-tab-name="profile"
>
<ProfileTab />
</div>
@@ -22,18 +24,21 @@
v-if="isLoggedIn"
:label="$t('settings.security_tab')"
icon="lock"
+ data-tab-name="security"
>
<SecurityTab />
</div>
<div
:label="$t('settings.filtering')"
icon="filter"
+ data-tab-name="filtering"
>
<FilteringTab />
</div>
<div
:label="$t('settings.theme')"
icon="brush"
+ data-tab-name="theme"
>
<ThemeTab />
</div>
@@ -41,6 +46,7 @@
v-if="isLoggedIn"
:label="$t('settings.notifications')"
icon="bell-ringing-o"
+ data-tab-name="notifications"
>
<NotificationsTab />
</div>
@@ -48,6 +54,7 @@
v-if="isLoggedIn"
:label="$t('settings.data_import_export_tab')"
icon="download"
+ data-tab-name="dataImportExport"
>
<DataImportExportTab />
</div>
@@ -56,12 +63,14 @@
:label="$t('settings.mutes_and_blocks')"
:fullHeight="true"
icon="eye-off"
+ data-tab-name="mutesAndBlocks"
>
<MutesAndBlocksTab />
</div>
<div
:label="$t('settings.version.title')"
icon="info-circled"
+ data-tab-name="version"
>
<VersionTab />
</div>