feat: replace carousel link URL with rich text body content and update UI views

This commit is contained in:
Suherdy Yacob 2026-06-14 09:35:59 +07:00
parent 01ea159235
commit 0fd9247560
5 changed files with 18 additions and 5 deletions

View File

@ -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)]

View File

@ -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.'
)

View File

@ -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."""

View File

@ -5,12 +5,11 @@
<field name="name">mapan.app.carousel.tree</field>
<field name="model">mapan.app.carousel</field>
<field name="arch" type="xml">
<list string="Carousel Slides" editable="top">
<list string="Carousel Slides">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="image" widget="image" options="{'size': [48, 48]}"/>
<field name="image_url"/>
<field name="link_url"/>
<field name="is_active"/>
</list>
</field>
@ -33,7 +32,6 @@
<group>
<field name="sequence"/>
<field name="is_active"/>
<field name="link_url" placeholder="https://..."/>
</group>
<group>
<field name="image" widget="image" options="{'size': [0, 200]}"/>
@ -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."/>
</group>
<notebook>
<page string="Detail Content" name="slide_detail_content">
<field name="body" widget="html"
placeholder="Enter the details content shown when the user taps this carousel slide..."/>
</page>
</notebook>
</sheet>
</form>
</field>

View File

@ -5,7 +5,7 @@
<field name="name">mapan.app.promo.tree</field>
<field name="model">mapan.app.promo</field>
<field name="arch" type="xml">
<list string="Promo Highlights" editable="top">
<list string="Promo Highlights">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="image" widget="image" options="{'size': [48, 48]}"/>