From 21da2e5160f5818d02afa09efcc0e7e0b338241a Mon Sep 17 00:00:00 2001 From: Alaguraj0361 Date: Wed, 4 Feb 2026 10:16:26 +0530 Subject: [PATCH] Add initial Chennora theme module with custom website layout, footer, and category slider. --- addons/dine360_theme_chennora/__manifest__.py | 1 + .../static/src/js/category_slider.js | 89 +++++++++ .../dine360_theme_chennora/views/layout.xml | 8 +- addons/dine360_theme_chennora/views/pages.xml | 169 +++++++----------- 4 files changed, 161 insertions(+), 106 deletions(-) create mode 100644 addons/dine360_theme_chennora/static/src/js/category_slider.js diff --git a/addons/dine360_theme_chennora/__manifest__.py b/addons/dine360_theme_chennora/__manifest__.py index da1050b..0d39933 100644 --- a/addons/dine360_theme_chennora/__manifest__.py +++ b/addons/dine360_theme_chennora/__manifest__.py @@ -17,6 +17,7 @@ 'dine360_theme_chennora/static/src/scss/primary_variables.scss', 'dine360_theme_chennora/static/src/scss/theme.scss', 'dine360_theme_chennora/static/src/js/deal_switcher.js', + 'dine360_theme_chennora/static/src/js/category_slider.js', ], }, 'images': [ diff --git a/addons/dine360_theme_chennora/static/src/js/category_slider.js b/addons/dine360_theme_chennora/static/src/js/category_slider.js new file mode 100644 index 0000000..7a5bdc4 --- /dev/null +++ b/addons/dine360_theme_chennora/static/src/js/category_slider.js @@ -0,0 +1,89 @@ +/** @odoo-module **/ + +import publicWidget from "@web/legacy/js/public/public_widget"; + +publicWidget.registry.CategoryCarousel = publicWidget.Widget.extend({ + selector: '.s_category_slider', + start: function () { + this.$track = this.$('.category-track'); + this.$items = this.$('.category-item'); + + if (!this.$track.length || !this.$items.length) { + return; + } + + this.currentIndex = 0; + this.totalOriginal = this.$items.length; + + // Clone all items and append for seamless loop + // We ensure we have enough content to scroll endlessly + const itemsToClone = this.$items.clone(); + this.$track.append(itemsToClone); + + // Update items list + this.$newItems = this.$('.category-item'); + + // 3 seconds interval + this._startAutoSlide(); + + // Pause on hover + this.$el.on('mouseenter', () => this._stopAutoSlide()); + this.$el.on('mouseleave', () => this._startAutoSlide()); + + // Handle window resize to reset alignment + $(window).on('resize', () => { + this._slide(true); + }); + + return this._super.apply(this, arguments); + }, + + _startAutoSlide: function () { + if (this.interval) clearInterval(this.interval); + this.interval = setInterval(this._slide.bind(this), 3000); // 3 seconds + }, + + _stopAutoSlide: function () { + if (this.interval) clearInterval(this.interval); + }, + + _slide: function (resize = false) { + if (resize) { + // Just reset position on resize to avoid misalignment + const itemWidth = this.$newItems.first().outerWidth(true); + this.$track.css({ + 'transition': 'none', + 'transform': `translateX(-${this.currentIndex * itemWidth}px)` + }); + return; + } + + // Get current item width (responsive) + const itemWidth = this.$newItems.first().outerWidth(true); + + this.currentIndex++; + + this.$track.css({ + 'transition': 'transform 0.5s ease-in-out', + 'transform': `translateX(-${this.currentIndex * itemWidth}px)` + }); + + // Loop check + // If we have moved past the original set + if (this.currentIndex >= this.totalOriginal) { + setTimeout(() => { + // Snap back to 0 (visually identical position) + // We use 0 because 0 is the start of Original Set + // When currentIndex == totalOriginal, we are at the start of Cloned Set + // Cloned Set is identical to Original Set. + this.$track.css({ + 'transition': 'none', + 'transform': 'translateX(0)' + }); + this.currentIndex = 0; + }, 500); // Wait for transition to finish + } + } +}); + +export default publicWidget.registry.CategoryCarousel; diff --git a/addons/dine360_theme_chennora/views/layout.xml b/addons/dine360_theme_chennora/views/layout.xml index 64b3d2a..83bb209 100644 --- a/addons/dine360_theme_chennora/views/layout.xml +++ b/addons/dine360_theme_chennora/views/layout.xml @@ -88,19 +88,19 @@ -
+ -
+ /contactus diff --git a/addons/dine360_theme_chennora/views/pages.xml b/addons/dine360_theme_chennora/views/pages.xml index a476871..e348659 100644 --- a/addons/dine360_theme_chennora/views/pages.xml +++ b/addons/dine360_theme_chennora/views/pages.xml @@ -272,111 +272,76 @@ -
+