Skip to content

Commit ac9ff26

Browse files
committed
⚡ splited active and hover item background color to menu and submenu
Signed-off-by: Enigma228322 <[email protected]>
1 parent faa37dd commit ac9ff26

File tree

2 files changed

+70
-24
lines changed

2 files changed

+70
-24
lines changed

theme_kit/models/theme.py

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ class ThemeTopPanel(models.Model):
104104
default=False, help="Active item Background color for Top Panel"
105105
)
106106

107+
top_panel_active_subitem_bg = fields.Char(
108+
"Active submenu item Background color",
109+
help="Active item Background color for Top Panel",
110+
)
111+
top_panel_active_subitem_bg_active = fields.Boolean(
112+
default=False, help="Active submenu item Background color for Top Panel"
113+
)
114+
107115
top_panel_hover_item_font = fields.Char(
108116
"Hover item Font color", help="Hover item Font color for Top Panel"
109117
)
@@ -117,6 +125,12 @@ class ThemeTopPanel(models.Model):
117125
top_panel_hover_item_bg_active = fields.Boolean(
118126
default=False, help="Hover item Background color for Top Panel"
119127
)
128+
top_panel_hover_subitem_bg = fields.Char(
129+
"Hover submenu item Background color", help="Hover item Background color for Top Panel"
130+
)
131+
top_panel_hover_subitem_bg_active = fields.Boolean(
132+
default=False, help="Hover submenu item Background color for Top Panel"
133+
)
120134

121135
# Compatibility theme_kit and material backend theme modules
122136
left_panel_main_menu = fields.Char(
@@ -163,10 +177,14 @@ def write(self, vals):
163177
self.top_panel_hover_item_font = ""
164178
if not vals.get("top_panel_hover_item_bg_active", "Not found"):
165179
self.top_panel_hover_item_bg = ""
180+
if not vals.get("top_panel_hover_subitem_bg_active", "Not found"):
181+
self.top_panel_hover_subitem_bg = ""
166182
if not vals.get("left_panel_main_menu_active", "Not found"):
167183
self.left_panel_main_menu = ""
168184
if not vals.get("left_panel_sub_menu_active", "Not found"):
169185
self.top_panel_hover_item_bg = ""
186+
if not vals.get("top_panel_active_subitem_bg_active", "Not found"):
187+
self.top_panel_active_subitem_bg = ""
170188

171189
@api.multi
172190
def _compute_less(self):
@@ -309,6 +327,16 @@ def _compute_less(self):
309327
code
310328
+ """.navbar-nav .active a{{
311329
background-color: {theme.top_panel_active_item_bg}!important;
330+
}}
331+
#odooMenuBarNav > div > div.o_sub_menu_content > ul > li > a.active{{
332+
background-color: {theme.top_panel_active_item_bg}!important;
333+
}}"""
334+
)
335+
if self.top_panel_active_subitem_bg_active:
336+
code = (
337+
code
338+
+ """#odooMenuBarNav > div > div.o_sub_menu_content > ul > li > ul > li.active > a{{
339+
background-color: {theme.top_panel_active_subitem_bg}!important;
312340
}}"""
313341
)
314342
if self.top_panel_hover_item_font_active:
@@ -347,31 +375,22 @@ def _compute_less(self):
347375
"""
348376
)
349377
if self.top_panel_hover_item_bg_active:
378+
# Compatibility theme_kit and material backend theme modules
350379
code = (
351380
code
352-
+ """.o_main_navbar > ul > li > a:hover{{
353-
background-color: {theme.top_panel_hover_item_bg}!important;
354-
}}
355-
.o_main_navbar > ul > li > a:focus{{
356-
background-color: {theme.top_panel_hover_item_bg}!important;
357-
}}
358-
.navbar-nav li a:hover{{
359-
background-color: {theme.top_panel_hover_item_bg}!important;
360-
}}
361-
.navbar-nav li a:focus{{
362-
background-color: {theme.top_panel_hover_item_bg}!important;
363-
}}
364-
.o_main_navbar > .o_menu_toggle:hover{{
365-
background-color: {theme.top_panel_hover_item_bg}!important;
381+
+ """#odooMenuBarNav > div > div.o_sub_menu_content > ul > li > a:hover{{
382+
background-color: {theme.top_panel_hover_item_bg} !important;
366383
}}
367-
.o_main_navbar > .o_menu_toggle:focus{{
368-
background-color: {theme.top_panel_hover_item_bg}!important;
384+
#odooMenuBarNav > div > div.o_sub_menu_content > ul > li > a:focus{{
385+
background-color: {theme.top_panel_hover_item_bg} !important;
369386
}}
370-
.open .dropdown-menu > li a:hover {{
371-
background-color: {theme.top_panel_hover_item_bg}!important;
372-
}}
373-
.open .dropdown-menu > li a:focus {{
374-
background-color: {theme.top_panel_hover_item_bg}!important;
387+
"""
388+
)
389+
if self.top_panel_hover_subitem_bg_active:
390+
code = (
391+
code
392+
+ """#odooMenuBarNav > div > div.o_sub_menu_content > ul > li > ul > li > a:hover {{
393+
background: {theme.top_panel_hover_subitem_bg} !important;
375394
}}
376395
"""
377396
)
@@ -614,13 +633,13 @@ def _compute_less(self):
614633
if self.left_panel_active_item_bg_active:
615634
code = (
616635
code
617-
+ """.o_sub_menu .oe_secondary_submenu .active a{{
636+
+ """.o_sub_menu .oe_secondary_submenu a:focus{{
618637
background-color: {theme.left_panel_active_item_bg}!important;
619638
}}
620-
.o_sub_menu .oe_secondary_submenu a:focus{{
639+
.o_mail_chat .o_mail_chat_sidebar .o_mail_chat_channel_item.o_active {{
621640
background-color: {theme.left_panel_active_item_bg}!important;
622641
}}
623-
.o_mail_chat .o_mail_chat_sidebar .o_mail_chat_channel_item.o_active {{
642+
#sidebar > li > a.active{{
624643
background-color: {theme.left_panel_active_item_bg}!important;
625644
}}
626645
"""

theme_kit/views/theme.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@
133133
class="oe_inline"
134134
/>
135135
</div>
136+
<div>
137+
<label for="top_panel_active_subitem_bg" />
138+
<field
139+
name="top_panel_active_subitem_bg_active"
140+
nolabel="1"
141+
class="oe_inline"/>
142+
<field
143+
name="top_panel_active_subitem_bg"
144+
widget="color"
145+
attrs="{'readonly':[('top_panel_active_subitem_bg_active','=',False)]}"
146+
class="oe_inline"
147+
/>
148+
</div>
136149
<div>
137150
<label for="top_panel_hover_item_font" />
138151
<field
@@ -161,6 +174,20 @@
161174
class="oe_inline"
162175
/>
163176
</div>
177+
<div>
178+
<label for="top_panel_hover_subitem_bg"/>
179+
<field
180+
name="top_panel_hover_subitem_bg_active"
181+
nolabel="1"
182+
class="oe_inline"
183+
/>
184+
<field
185+
name="top_panel_hover_subitem_bg"
186+
widget="color"
187+
attrs="{'readonly':[('top_panel_hover_subitem_bg_active','=',False)]}"
188+
class="oe_inline"
189+
/>
190+
</div>
164191
<!-- Compatibility theme_kit and material backend theme modules -->
165192
<div
166193
attrs="{'invisible':[('backend_theme_installed', '=', False)]}"

0 commit comments

Comments
 (0)