From c1a6ba6242582b6cf0eb2a0b9c8b3465cc8ad970 Mon Sep 17 00:00:00 2001 From: Forrest Hatfield Date: Sun, 9 Sep 2018 04:58:02 -0500 Subject: [PATCH] Saved sort selection into local storage for later use - fixes #10432 (#10655) * Saved sort selection into local storage for later use * Updated code to use userLocalManager module --- website/client/components/inventory/stable/index.vue | 11 ++++++++++- website/client/libs/userlocalManager.js | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/website/client/components/inventory/stable/index.vue b/website/client/components/inventory/stable/index.vue index 8024afae6f..e659d2ef99 100644 --- a/website/client/components/inventory/stable/index.vue +++ b/website/client/components/inventory/stable/index.vue @@ -399,6 +399,8 @@ import openedItemRowsMixin from 'client/mixins/openedItemRows'; import petMixin from 'client/mixins/petMixin'; + import { CONSTANTS, setLocalSetting, getLocalSetting } from 'client/libs/userlocalManager'; + // TODO Normalize special pets and mounts // import Store from 'client/store'; // import deepFreeze from 'client/libs/deepFreeze'; @@ -430,13 +432,15 @@ mousePosition: MouseMoveDirective, }, data () { + const stableSortState = getLocalSetting(CONSTANTS.keyConstants.STABLE_SORT_STATE) || 'standard'; + return { viewOptions: {}, hideMissing: false, searchText: null, searchTextThrottled: '', // sort has the translation-keys as values - selectedSortBy: 'standard', + selectedSortBy: stableSortState, sortByItems: [ 'standard', 'AZ', @@ -461,6 +465,11 @@ let search = this.searchText.toLowerCase(); this.searchTextThrottled = search; }, 250), + selectedSortBy: { + handler () { + setLocalSetting(CONSTANTS.keyConstants.STABLE_SORT_STATE, this.selectedSortBy); + }, + }, }, computed: { ...mapState({ diff --git a/website/client/libs/userlocalManager.js b/website/client/libs/userlocalManager.js index 0e70869a3f..1c2f00343a 100644 --- a/website/client/libs/userlocalManager.js +++ b/website/client/libs/userlocalManager.js @@ -4,6 +4,7 @@ const CONSTANTS = { SPELL_DRAWER_STATE: 'spell-drawer-state', EQUIPMENT_DRAWER_STATE: 'equipment-drawer-state', CURRENT_EQUIPMENT_DRAWER_TAB: 'current-equipment-drawer-tab', + STABLE_SORT_STATE: 'stable-sort-state', }, drawerStateValues: { DRAWER_CLOSED: 'drawer-closed',