refactor list tweaks

This commit is contained in:
Gamebrary 2020-08-21 07:38:03 -07:00
parent 90bc7bafb8
commit babe9bd806
3 changed files with 17 additions and 15 deletions

View file

@ -11,7 +11,7 @@
<sort-list :list="list" :list-index="listIndex" />
<rename-list :list="list" :list-index="listIndex" />
<change-list-view :list="list" :list-index="listIndex" />
<!-- <list-tweaks :list-index="listIndex" /> -->
<list-tweaks :list="list" :list-index="listIndex" />
<b-dropdown-divider />

View file

@ -56,11 +56,8 @@ import { mapState } from 'vuex';
export default {
props: {
listIndex: {
type: Number,
required: true,
default: 0,
},
listIndex: Number,
list: Object,
},
data() {
@ -96,7 +93,7 @@ export default {
showGameNotes,
showGameTags,
showGameCount,
} = this.gameLists[this.platform.code][this.listIndex];
} = this.list.settings;
this.showReleaseDates = showReleaseDates || false;
this.showGameRatings = showGameRatings || false;
@ -107,18 +104,19 @@ export default {
},
async save() {
const { listIndex, list: { settings } } = this;
this.saving = true;
const gameLists = JSON.parse(JSON.stringify(this.gameLists));
settings.showReleaseDates = this.showReleaseDates;
settings.showGameRatings = this.showGameRatings;
settings.showGameProgress = this.showGameProgress;
settings.showGameNotes = this.showGameNotes;
settings.showGameTags = this.showGameTags;
settings.showGameCount = this.showGameCount;
gameLists[this.platform.code][this.listIndex].showReleaseDates = this.showReleaseDates;
gameLists[this.platform.code][this.listIndex].showGameRatings = this.showGameRatings;
gameLists[this.platform.code][this.listIndex].showGameProgress = this.showGameProgress;
gameLists[this.platform.code][this.listIndex].showGameNotes = this.showGameNotes;
gameLists[this.platform.code][this.listIndex].showGameTags = this.showGameTags;
gameLists[this.platform.code][this.listIndex].showGameCount = this.showGameCount;
this.$store.commit('SET_LIST_SETTINGS', { listIndex, settings });
await this.$store.dispatch('SAVE_LIST_LEGACY', gameLists)
await this.$store.dispatch('SAVE_BOARD')
.catch(() => {
this.saving = false;

View file

@ -61,6 +61,10 @@ export default {
Vue.set(state.board.lists[listIndex].settings, 'view', view);
},
SET_LIST_SETTINGS(state, { listIndex, settings }) {
Vue.set(state.board.lists[listIndex], 'settings', settings);
},
RENAME_LIST(state, { listIndex, listName }) {
state.board.lists[listIndex].name = listName;
},