117 lines
5.1 KiB
XML
117 lines
5.1 KiB
XML
<!-- custom_template_khmer/templates/layout_inherit.xml -->
|
|
<odoo>
|
|
<!-- Backend Layout -->
|
|
<template id="web_layout_inherit" inherit_id="web.layout" name="Khmer Theme Backend">
|
|
<xpath expr="//head" position="inside">
|
|
<t t-call="custom_template_khmer.dynamic_css_injector"/>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- Website Layout -->
|
|
<template id="website_layout_inherit" inherit_id="website.layout" name="Khmer Theme Website">
|
|
<xpath expr="//head" position="inside">
|
|
<t t-call="custom_template_khmer.dynamic_css_injector"/>
|
|
</xpath>
|
|
</template>
|
|
|
|
<!-- Dynamic CSS Injector -->
|
|
<template id="dynamic_css_injector" name="Dynamic CSS Injector">
|
|
<style type="text/css">
|
|
<t t-set="config" t-value="env['custom.theme.config'].sudo().search([], limit=1)"/>
|
|
|
|
<!-- 1. DYNAMIC FONT -->
|
|
<!-- Inside templates/layout_inherit.xml -->
|
|
<t t-if="config and config.font_file">
|
|
<!-- 1. Define the Font Face -->
|
|
@font-face {
|
|
/* Use the EXACT name from your Settings field */
|
|
font-family: '<t t-esc="config.font_name"/>';
|
|
|
|
/* Dynamic URL to your controller */
|
|
src: url('/custom_template_khmer/fonts?t=<t t-esc="config.id"/>') format('truetype');
|
|
|
|
font-weight: normal;
|
|
font-style: normal;
|
|
font-display: swap;
|
|
}
|
|
|
|
/* 2. Apply the Font Globally */
|
|
/* We simply use the name defined above. No src here! */
|
|
body,form,.o_cp_buttons,.oe_secondary_menu,
|
|
.o_web_client,.o_content,.o_main_navbar,o-dropdown-item.dropdown-item.o-navigable,
|
|
.o_form_view .oe_title > h1, .o_form_view .oe_title > .h1, .o_form_view .oe_title > h2, .o_form_view .oe_title > .h2, .o_form_view .oe_title > h3, .o_form_view .oe_title > .h3{
|
|
font-family: '<t t-esc="config.font_name"/>', Khmer-Font !important;
|
|
}
|
|
</t>
|
|
|
|
<!-- 2. DYNAMIC MENU COLOR -->
|
|
<t t-if="config and config.menu_bg_color">
|
|
:root {
|
|
--khmer-menu-bg: <t t-esc="config.menu_bg_color"/>;
|
|
}
|
|
|
|
.o_main_navbar,
|
|
.o_menu_navbar,
|
|
#o_main_navbar,
|
|
header.o_navbar,
|
|
.o_navbar,
|
|
.navbar-expand-md,
|
|
.o_menu_systray,
|
|
.o_menu_sections {
|
|
background-color: <t t-esc="config.menu_bg_color"/> !important;
|
|
background: <t t-esc="config.menu_bg_color"/> !important;
|
|
}
|
|
|
|
.o_menu_sections.d-flex.flex-grow-1.flex-shrink-1.w-0{
|
|
background-color: <t t-esc="config.menu_bg_color"/> !important;
|
|
background: <t t-esc="config.menu_bg_color"/> !important;
|
|
}
|
|
|
|
.o-dropdown-item.dropdown-item.o-navigable.o_nav_entry{
|
|
background-color: <t t-esc="config.menu_bg_color"/> !important;
|
|
background: <t t-esc="config.menu_bg_color"/> !important;
|
|
}
|
|
.o_main_navbar .o_nav_entry, .o_main_navbar .dropdown-toggle:not(.o-dropdown-toggle-custo){
|
|
background-color: <t t-esc="config.menu_bg_color"/> !important;
|
|
background: <t t-esc="config.menu_bg_color"/> !important;
|
|
}
|
|
.o_menu_brand,
|
|
.navbar-brand {
|
|
background-color: <t t-esc="config.menu_bg_color"/> !important;
|
|
color: #FFFFFF !important;
|
|
}
|
|
|
|
<!-- With background image -->
|
|
<t t-if="config.menu_bg_image">
|
|
.o_main_navbar,
|
|
.o_menu_navbar,
|
|
#o_main_navbar {
|
|
background-image: url('/custom_template_khmer/menu_image?t=<t t-esc="config.id"/>') !important;
|
|
background-size: cover !important;
|
|
background-blend-mode: overlay !important;
|
|
}
|
|
</t>
|
|
|
|
.o_navbar_main_menu,
|
|
.navbar-custom,
|
|
#wrapwrap header {
|
|
background-color: <t t-esc="config.menu_bg_color"/> !important;
|
|
}
|
|
</t>
|
|
|
|
<!-- 3. RESPONSIVE DESIGN -->
|
|
<t t-if="config and config.is_responsive">
|
|
@media (max-width: 768px) {
|
|
.o_main_navbar { min-height: 40px; font-size: 13px; }
|
|
.o_menu_brand { font-size: 16px !important; }
|
|
}
|
|
@media (min-width: 769px) and (max-width: 1024px) {
|
|
.o_main_navbar { min-height: 44px; font-size: 14px; }
|
|
}
|
|
@media (min-width: 1025px) {
|
|
.o_main_navbar { min-height: 46px; font-size: 15px; }
|
|
}
|
|
</t>
|
|
</style>
|
|
</template>
|
|
</odoo> |