Эх сурвалжийг харах

Добавлена настройка "Показывать жанры"

Book Pauk 2 жил өмнө
parent
commit
1cfa787e5a

+ 17 - 1
client/components/Search/BookView/BookView.vue

@@ -17,7 +17,7 @@
             <q-icon name="la la-copy" size="20px" />
         </div>
 
-        <div class="q-ml-sm">
+        <div v-if="showGenres" class="q-ml-sm">
             {{ bookGenre }}
         </div>
 
@@ -33,6 +33,9 @@ const componentOptions = {
     components: {
     },
     watch: {
+        settings() {
+            this.loadSettings();
+        },
     }
 };
 class BookView {
@@ -42,7 +45,20 @@ class BookView {
         genreTree: Array,
     };
 
+    showGenres = true;
+
     created() {
+        this.loadSettings();
+    }
+
+    loadSettings() {
+        const settings = this.settings;
+
+        this.showGenres = settings.showGenres;
+    }
+
+    get settings() {
+        return this.$store.state.settings;
     }
 
     get bookSize() {

+ 6 - 0
client/components/Search/Search.vue

@@ -208,6 +208,7 @@
                 </div>
 
                 <q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
+                <q-checkbox v-model="showGenres" size="36px" label="Показывать жанры" />
                 <q-checkbox v-model="showDeleted" size="36px" label="Показывать удаленные" />
                 <q-checkbox v-model="abCacheEnabled" size="36px" label="Кешировать запросы" />
             </div>
@@ -276,6 +277,9 @@ const componentOptions = {
         showCounts(newValue) {
             this.setSetting('showCounts', newValue);
         },
+        showGenres(newValue) {
+            this.setSetting('showGenres', newValue);
+        },
         showDeleted(newValue) {
             this.setSetting('showDeleted', newValue);
             this.updateTableData();
@@ -326,6 +330,7 @@ class Search {
     expanded = [];
     expandedSeries = [];
     showCounts = true;
+    showGenres = true;
     showDeleted = false;
     abCacheEnabled = true;
     langDefault = '';
@@ -389,6 +394,7 @@ class Search {
         this.expanded = _.cloneDeep(settings.expanded);
         this.expandedSeries = _.cloneDeep(settings.expandedSeries);
         this.showCounts = settings.showCounts;
+        this.showGenres = settings.showGenres;
         this.showDeleted = settings.showDeleted;
         this.abCacheEnabled = settings.abCacheEnabled;
         this.langDefault = settings.langDefault;

+ 1 - 0
client/store/root.js

@@ -6,6 +6,7 @@ const state = {
         expanded: [],
         expandedSeries: [],
         showCounts: true,
+        showGenres: true,
         showDeleted: false,
         abCacheEnabled: true,
         langDefault: '',