feat: add setting to control category products button visibility
- Add show_category_products_button field to StoreDTO - Update SettingsSerializerService to support new field - Add setting in admin panel on 'Store' tab with toggle - Pass setting to SPA through SettingsHandler - Button displays only for categories with child categories - Add default value true to configuration
This commit is contained in:
@@ -12,6 +12,7 @@ export const useSettingsStore = defineStore('settings', {
|
||||
ya_metrika_enabled: false,
|
||||
feature_coupons: false,
|
||||
feature_vouchers: false,
|
||||
show_category_products_button: true,
|
||||
currency_code: null,
|
||||
theme: {
|
||||
light: 'light', dark: 'dark', variables: {
|
||||
@@ -43,6 +44,7 @@ export const useSettingsStore = defineStore('settings', {
|
||||
this.store_enabled = settings.store_enabled;
|
||||
this.feature_coupons = settings.feature_coupons;
|
||||
this.feature_vouchers = settings.feature_vouchers;
|
||||
this.show_category_products_button = settings.show_category_products_button ?? true;
|
||||
this.currency_code = settings.currency_code;
|
||||
this.texts = settings.texts;
|
||||
this.mainpage_blocks = settings.mainpage_blocks;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="parentCategory"
|
||||
v-if="parentCategory && parentCategory.children?.length && settings.show_category_products_button"
|
||||
class="py-2 px-4 flex items-center mb-3 cursor-pointer border-b w-full pb-2 border-base-200"
|
||||
@click.prevent="showProductsInParentCategory"
|
||||
>
|
||||
@@ -59,11 +59,13 @@ import {useCategoriesStore} from "@/stores/CategoriesStore.js";
|
||||
import {useRoute} from "vue-router";
|
||||
import CategoryItem from "@/components/CategoriesList/CategoryItem.vue";
|
||||
import {useYaMetrikaStore} from "@/stores/yaMetrikaStore.js";
|
||||
import {useSettingsStore} from "@/stores/SettingsStore.js";
|
||||
import BaseViewWrapper from "@/views/BaseViewWrapper.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const categoriesStore = useCategoriesStore();
|
||||
const yaMetrika = useYaMetrikaStore();
|
||||
const settings = useSettingsStore();
|
||||
|
||||
const parentId = computed(() => route.params.id ? Number(route.params.id) : null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user