feat: replace carousel link URL with rich text body content and update UI views
This commit is contained in:
parent
01ea159235
commit
0fd9247560
@ -84,7 +84,7 @@ class AppNotificationController(http.Controller):
|
|||||||
carousel_domain = [('is_active', '=', True)]
|
carousel_domain = [('is_active', '=', True)]
|
||||||
carousel_items = request.env['mapan.app.carousel'].sudo().search_read(
|
carousel_items = request.env['mapan.app.carousel'].sudo().search_read(
|
||||||
carousel_domain,
|
carousel_domain,
|
||||||
['id', 'name', 'image', 'image_url', 'link_url', 'sequence'],
|
['id', 'name', 'image', 'image_url', 'body', 'sequence'],
|
||||||
order='sequence, id'
|
order='sequence, id'
|
||||||
)
|
)
|
||||||
for item in carousel_items:
|
for item in carousel_items:
|
||||||
@ -93,6 +93,8 @@ class AppNotificationController(http.Controller):
|
|||||||
item['image'] = img.decode('utf-8')
|
item['image'] = img.decode('utf-8')
|
||||||
elif not img:
|
elif not img:
|
||||||
item['image'] = None
|
item['image'] = None
|
||||||
|
if item.get('body') is False:
|
||||||
|
item['body'] = ''
|
||||||
|
|
||||||
# --- Promo Highlights ---
|
# --- Promo Highlights ---
|
||||||
promo_domain = [('is_active', '=', True)]
|
promo_domain = [('is_active', '=', True)]
|
||||||
|
|||||||
@ -30,3 +30,9 @@ class AppCarousel(models.Model):
|
|||||||
string='Tap URL',
|
string='Tap URL',
|
||||||
help='URL to open when the user taps this carousel slide. Leave empty for no action.'
|
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.'
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class AppCmsConfig(models.Model):
|
|||||||
'primary_color': '#C62828',
|
'primary_color': '#C62828',
|
||||||
'secondary_color': '#FF8F00'
|
'secondary_color': '#FF8F00'
|
||||||
})
|
})
|
||||||
|
return config
|
||||||
@api.model
|
@api.model
|
||||||
def action_open_config(self):
|
def action_open_config(self):
|
||||||
"""Action to open the singleton configuration record."""
|
"""Action to open the singleton configuration record."""
|
||||||
|
|||||||
@ -5,12 +5,11 @@
|
|||||||
<field name="name">mapan.app.carousel.tree</field>
|
<field name="name">mapan.app.carousel.tree</field>
|
||||||
<field name="model">mapan.app.carousel</field>
|
<field name="model">mapan.app.carousel</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<list string="Carousel Slides" editable="top">
|
<list string="Carousel Slides">
|
||||||
<field name="sequence" widget="handle"/>
|
<field name="sequence" widget="handle"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="image" widget="image" options="{'size': [48, 48]}"/>
|
<field name="image" widget="image" options="{'size': [48, 48]}"/>
|
||||||
<field name="image_url"/>
|
<field name="image_url"/>
|
||||||
<field name="link_url"/>
|
|
||||||
<field name="is_active"/>
|
<field name="is_active"/>
|
||||||
</list>
|
</list>
|
||||||
</field>
|
</field>
|
||||||
@ -33,7 +32,6 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="sequence"/>
|
<field name="sequence"/>
|
||||||
<field name="is_active"/>
|
<field name="is_active"/>
|
||||||
<field name="link_url" placeholder="https://..."/>
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="image" widget="image" options="{'size': [0, 200]}"/>
|
<field name="image" widget="image" options="{'size': [0, 200]}"/>
|
||||||
@ -44,6 +42,12 @@
|
|||||||
placeholder="https://example.com/banner.jpg"
|
placeholder="https://example.com/banner.jpg"
|
||||||
help="If no image is uploaded above, the app will load the image from this URL."/>
|
help="If no image is uploaded above, the app will load the image from this URL."/>
|
||||||
</group>
|
</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>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<field name="name">mapan.app.promo.tree</field>
|
<field name="name">mapan.app.promo.tree</field>
|
||||||
<field name="model">mapan.app.promo</field>
|
<field name="model">mapan.app.promo</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<list string="Promo Highlights" editable="top">
|
<list string="Promo Highlights">
|
||||||
<field name="sequence" widget="handle"/>
|
<field name="sequence" widget="handle"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="image" widget="image" options="{'size': [48, 48]}"/>
|
<field name="image" widget="image" options="{'size': [48, 48]}"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user