合并企业版代码(未测试,先提交到测试分支)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// = Navbar
|
||||
// ============================================================================
|
||||
// No CSS hacks, variables overrides only
|
||||
|
||||
.o_main_navbar {
|
||||
--o-navbar-badge-bg: #{$primary};
|
||||
--o-navbar-badge-color: #{$white};
|
||||
--o-navbar-badge-text-shadow: none;
|
||||
}
|
||||
47
web_enterprise/static/src/webclient/navbar/navbar.js
Normal file
47
web_enterprise/static/src/webclient/navbar/navbar.js
Normal file
@@ -0,0 +1,47 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { NavBar } from "@web/webclient/navbar/navbar";
|
||||
import { useService, useBus } from "@web/core/utils/hooks";
|
||||
|
||||
const { useEffect, useRef } = owl;
|
||||
|
||||
export class EnterpriseNavBar extends NavBar {
|
||||
setup() {
|
||||
super.setup();
|
||||
this.hm = useService("home_menu");
|
||||
this.menuAppsRef = useRef("menuApps");
|
||||
this.navRef = useRef("nav");
|
||||
useBus(this.env.bus, "HOME-MENU:TOGGLED", () => this._updateMenuAppsIcon());
|
||||
useEffect(() => this._updateMenuAppsIcon());
|
||||
}
|
||||
get hasBackgroundAction() {
|
||||
return this.hm.hasBackgroundAction;
|
||||
}
|
||||
get isInApp() {
|
||||
return !this.hm.hasHomeMenu;
|
||||
}
|
||||
_updateMenuAppsIcon() {
|
||||
const menuAppsEl = this.menuAppsRef.el;
|
||||
menuAppsEl.classList.toggle("o_hidden", !this.isInApp && !this.hasBackgroundAction);
|
||||
menuAppsEl.classList.toggle(
|
||||
"o_menu_toggle_back",
|
||||
!this.isInApp && this.hasBackgroundAction
|
||||
);
|
||||
const { _t } = this.env;
|
||||
const title =
|
||||
!this.isInApp && this.hasBackgroundAction ? _t("Previous view") : _t("Home menu");
|
||||
menuAppsEl.title = title;
|
||||
menuAppsEl.ariaLabel = title;
|
||||
|
||||
const menuBrand = this.navRef.el.querySelector(".o_menu_brand");
|
||||
if (menuBrand) {
|
||||
menuBrand.classList.toggle("o_hidden", !this.isInApp);
|
||||
}
|
||||
|
||||
const appSubMenus = this.appSubMenus.el;
|
||||
if (appSubMenus) {
|
||||
appSubMenus.classList.toggle("o_hidden", !this.isInApp);
|
||||
}
|
||||
}
|
||||
}
|
||||
EnterpriseNavBar.template = "web_enterprise.EnterpriseNavBar";
|
||||
63
web_enterprise/static/src/webclient/navbar/navbar.scss
Normal file
63
web_enterprise/static/src/webclient/navbar/navbar.scss
Normal file
@@ -0,0 +1,63 @@
|
||||
// = Main Navbar
|
||||
// ============================================================================
|
||||
.o_main_navbar {
|
||||
.o_menu_toggle {
|
||||
@extend %-main-navbar-entry-base;
|
||||
@extend %-main-navbar-entry-spacing;
|
||||
color: $o-navbar-entry-color;
|
||||
|
||||
rect, g {
|
||||
transform-origin: 0 50%;
|
||||
}
|
||||
|
||||
// Define a local mixin to handle the toggle state
|
||||
// --------------------------------------------------------------------
|
||||
@mixin o_main_navbar_toggler_toggled() {
|
||||
rect {
|
||||
width: 6px;
|
||||
height: 3px;
|
||||
|
||||
&:first-child {
|
||||
transform: translate(12%,0);
|
||||
rx: 1;
|
||||
}
|
||||
}
|
||||
|
||||
#o_menu_toggle_row_0 {
|
||||
transform: scale3d(.5, 1, 1) translate(0, 45%) skewY(-22deg);
|
||||
|
||||
+ g rect {
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#o_menu_toggle_row_2 {
|
||||
transform: scale3d(.5, 1, 1) translate(0, -37%) skewY(22deg);
|
||||
}
|
||||
}
|
||||
|
||||
&.o_menu_toggle_back {
|
||||
@include o_main_navbar_toggler_toggled();
|
||||
transform: scaleX(-1);
|
||||
}
|
||||
|
||||
// Animate on large screen without 'reduced-motion' only.
|
||||
// --------------------------------------------------------------------
|
||||
@include media-breakpoint-up(lg) {
|
||||
@media screen and (prefers-reduced-motion: no-preference) {
|
||||
&:hover {
|
||||
@include o_main_navbar_toggler_toggled();
|
||||
}
|
||||
|
||||
&, g {
|
||||
transition: all .3s;
|
||||
}
|
||||
|
||||
rect {
|
||||
transition: all .1s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// = Navbar Variables
|
||||
// ============================================================================
|
||||
// No CSS hacks, variables overrides only
|
||||
$o-navbar-border-bottom: 1px solid $o-border-color !default;
|
||||
|
||||
$o-navbar-background: $o-view-background-color!default;
|
||||
$o-navbar-entry-color: $o-gray-900 !default;
|
||||
|
||||
$o-navbar-home-menu-badge-bg: $o-enterprise-primary-color !default;
|
||||
@@ -0,0 +1,9 @@
|
||||
// = Enterprise Main Navbar Variables
|
||||
// ============================================================================
|
||||
$o-navbar-border-bottom: 0 !default;
|
||||
|
||||
$o-navbar-background: linear-gradient(45deg, $o-brand-odoo, adjust-color($o-brand-odoo, $saturation: -8%, $lightness: -4%)) !default;
|
||||
|
||||
$o-navbar-badge-size-adjust: 0 !default;
|
||||
$o-navbar-badge-bg: $o-enterprise-primary-color-light !default;
|
||||
$o-navbar-home-menu-badge-bg: $o-brand-primary !default;
|
||||
19
web_enterprise/static/src/webclient/navbar/navbar.xml
Normal file
19
web_enterprise/static/src/webclient/navbar/navbar.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="web_enterprise.EnterpriseNavBar" t-inherit="web.NavBar" t-inherit-mode="primary">
|
||||
<xpath expr="//nav" position="attributes">
|
||||
<attribute name="t-ref">nav</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-call='web.NavBar.AppsMenu']" position="replace">
|
||||
<a href="#" class="o_menu_toggle" accesskey="h" t-ref="menuApps" t-on-click.prevent="() => this.hm.toggle()">
|
||||
<svg width="14px" height="14px" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg" >
|
||||
<g t-foreach="[0, 5, 10]" t-as="Y" t-att-id="'o_menu_toggle_row_' + Y_index" fill="currentColor" t-key="'o_menu_toggle_row_' + Y_index">
|
||||
<rect t-foreach="[0, 5, 10]" t-as="X" width="4" height="4" t-att-x="X" t-att-y="Y" t-key="'o_menu_toggle_cell_' + X_index"/>
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Reference in New Issue
Block a user