High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
JavaScript campaigncampaign-managementemail-marketingemail-subscriptionlistmonkmailing-listnewsletternewsletter-managementnewsletter-softwareself-hostedsms-gatewaysmtptransactional-emails
Remember last chosen tab on the settings UI.
Kailash Nadh93366f4e9eca
diff --git a/frontend/src/utils.js b/frontend/src/utils.jsindex a88188e7..e5276d9d 100644--- a/frontend/src/utils.js+++ b/frontend/src/utils.js@@ -8,6 +8,7 @@ import relativeTime from 'dayjs/plugin/relativeTime';dayjs.extend(relativeTime);const reEmail = /(.+?)@(.+?)/ig;+const prefKey = 'listmonk_pref';const htmlEntities = {'&': '&',@@ -188,4 +189,23 @@ export default class Utils {return obj;};++ getPref = (key) => {+ if (localStorage.getItem(prefKey) === null) {+ return null;+ }++ const p = JSON.parse(localStorage.getItem(prefKey));+ return key in p ? p[key] : null;+ };++ setPref = (key, val) => {+ let p = {};+ if (localStorage.getItem(prefKey) !== null) {+ p = JSON.parse(localStorage.getItem(prefKey));+ }++ p[key] = val;+ localStorage.setItem(prefKey, JSON.stringify(p));+ }}diff --git a/frontend/src/views/Settings.vue b/frontend/src/views/Settings.vueindex 8709cd8c..94793c43 100644--- a/frontend/src/views/Settings.vue+++ b/frontend/src/views/Settings.vue@@ -21,7 +21,7 @@<hr /><section class="wrap">- <b-tabs type="is-boxed" :animated="false">+ <b-tabs type="is-boxed" :animated="false" v-model="tab"><b-tab-item :label="$t('settings.general.name')" label-position="on-border"><general-settings :form="form" :key="key" /></b-tab-item><!-- general -->@@ -98,6 +98,7 @@ export default Vue.extend({// form is compared to detect changes.formCopy: '',form: {},+ tab: 0,};},@@ -237,7 +238,15 @@ export default Vue.extend({},mounted() {+ this.tab = this.$utils.getPref('settings.tab') || 0;this.getSettings();},++ watch: {+ // Capture contentType and body passed from the parent as props.+ tab(t) {+ this.$utils.setPref('settings.tab', t);+ },+ },});</script>