Skip to content

Commit

Permalink
[IMP] web_company_color: apply colors in debug assets and edit menu c…
Browse files Browse the repository at this point in the history
…olors

Allow each company's colors to be visible when running in debug assets mode. Fix the menu colors so they don't look like hyperlinks.
  • Loading branch information
ThiagoMForgeFlow committed Jan 9, 2025
1 parent 61dbaa2 commit e56871c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions web_company_color/models/ir_qweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@ def _generate_asset_links_cache(
res += [asset.get_company_color_asset_node()]
return res

def _generate_asset_links(
self,
bundle,
css=True,
js=True,
debug_assets=False,
assets_params=None,
rtl=False,
):
res = super()._generate_asset_links(
bundle,
css=css,
js=js,
debug_assets=debug_assets,
assets_params=assets_params,
rtl=rtl,
)
if bundle == "web_company_color.company_color_assets":
asset = AssetsBundleCompanyColor(
bundle, [], env=self.env, css=True, js=True
)
res += [asset.get_company_color_asset_node()]
return res

def _get_asset_content(self, bundle, assets_params=None):
"""Handle 'special' web_company_color bundle"""
if bundle == "web_company_color.company_color_assets":
Expand Down
5 changes: 5 additions & 0 deletions web_company_color/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ class ResCompany(models.Model):
background-color: %(color_navbar_bg_hover)s !important;
}
}
.dropdown-item{
color: %(color_submenu_text)s !important;
}
"""

company_colors = fields.Serialized()
Expand All @@ -137,6 +140,7 @@ class ResCompany(models.Model):
color_link_text_hover = fields.Char(
"Link Text Color Hover", sparse="company_colors"
)
color_submenu_text = fields.Char("Submenu Text Color", sparse="company_colors")
scss_modif_timestamp = fields.Char("SCSS Modif. Timestamp")

@api.model_create_multi
Expand Down Expand Up @@ -213,6 +217,7 @@ def _scss_get_sanitized_values(self):
"color_link_text": values.get("color_link_text") or "#71639e",
"color_link_text_hover": values.get("color_link_text_hover")
or "darken(#71639e, 10%)",
"color_submenu_text": values.get("color_link_text") or "#374151",
}
)
return values
Expand Down

0 comments on commit e56871c

Please sign in to comment.