From 0fd9247560a7160a7e84b42a2c25885ad2e2fcc9 Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Sun, 14 Jun 2026 09:35:59 +0700 Subject: [PATCH] feat: replace carousel link URL with rich text body content and update UI views --- controllers/main.py | 4 +++- models/app_carousel.py | 6 ++++++ models/app_cms_config.py | 1 + views/app_carousel_views.xml | 10 +++++++--- views/app_promo_views.xml | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/controllers/main.py b/controllers/main.py index ef60b5d..b278ef7 100644 --- a/controllers/main.py +++ b/controllers/main.py @@ -84,7 +84,7 @@ class AppNotificationController(http.Controller): carousel_domain = [('is_active', '=', True)] carousel_items = request.env['mapan.app.carousel'].sudo().search_read( carousel_domain, - ['id', 'name', 'image', 'image_url', 'link_url', 'sequence'], + ['id', 'name', 'image', 'image_url', 'body', 'sequence'], order='sequence, id' ) for item in carousel_items: @@ -93,6 +93,8 @@ class AppNotificationController(http.Controller): item['image'] = img.decode('utf-8') elif not img: item['image'] = None + if item.get('body') is False: + item['body'] = '' # --- Promo Highlights --- promo_domain = [('is_active', '=', True)] diff --git a/models/app_carousel.py b/models/app_carousel.py index 70c4d7d..fd26538 100644 --- a/models/app_carousel.py +++ b/models/app_carousel.py @@ -30,3 +30,9 @@ class AppCarousel(models.Model): string='Tap URL', help='URL to open when the user taps this carousel slide. Leave empty for no action.' ) + + body = fields.Html( + string='Slide Detail Content', + help='Rich text content shown when the user taps on this carousel slide.' + ) + diff --git a/models/app_cms_config.py b/models/app_cms_config.py index c41aae9..b4c210a 100644 --- a/models/app_cms_config.py +++ b/models/app_cms_config.py @@ -43,6 +43,7 @@ class AppCmsConfig(models.Model): 'primary_color': '#C62828', 'secondary_color': '#FF8F00' }) + return config @api.model def action_open_config(self): """Action to open the singleton configuration record.""" diff --git a/views/app_carousel_views.xml b/views/app_carousel_views.xml index 0a5775c..3c8b347 100644 --- a/views/app_carousel_views.xml +++ b/views/app_carousel_views.xml @@ -5,12 +5,11 @@ mapan.app.carousel.tree mapan.app.carousel - + - @@ -33,7 +32,6 @@ - @@ -44,6 +42,12 @@ placeholder="https://example.com/banner.jpg" help="If no image is uploaded above, the app will load the image from this URL."/> + + + + + diff --git a/views/app_promo_views.xml b/views/app_promo_views.xml index e1aacc8..03c5012 100644 --- a/views/app_promo_views.xml +++ b/views/app_promo_views.xml @@ -5,7 +5,7 @@ mapan.app.promo.tree mapan.app.promo - +