From 01706392620e909b8deb9fdb1ea7793516bb8e16 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 12 Nov 2018 12:37:09 +0000 Subject: [FIX] website: restore customize menu loading When opening the customize menu as soon as the page became visible, an RPC crashed and the toggable options did not appear anymore. This happened: 1) DOM is ready. 2) The user click on the menu. 3) At the same time, the customize menu is initialized (`attachTo`), its event handlers are bound and the async `willStart` method is called. 4) The event handler for the user click is called... and crashes as requires a variable which would have been set in the `start` method. The bug did not appear in previous versions as the handler was not using the standard system and bound the event handler "by hand" in the `start` method. Maybe `attachTo` should not bind event handlers before the `willStart` method is completed; this would be a subject for the master branch. This commit solves the problem by setting the required variable in the `willStart` method instead of the `start` method. closes odoo/odoo#28578 --- addons/website/static/src/js/menu/customize.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/menu/customize.js b/addons/website/static/src/js/menu/customize.js index d8ce436248e..b931e938cc6 100644 --- a/addons/website/static/src/js/menu/customize.js +++ b/addons/website/static/src/js/menu/customize.js @@ -18,8 +18,14 @@ var CustomizeMenu = Widget.extend({ /** * @override */ - start: function () { + willStart: function () { this.viewName = $(document.documentElement).data('view-xmlid'); + return this._super.apply(this, arguments); + }, + /** + * @override + */ + start: function () { if (!this.viewName) { _.defer(this.destroy.bind(this)); } @@ -27,6 +33,7 @@ var CustomizeMenu = Widget.extend({ if (this.$el.is('.show')) { this._loadCustomizeOptions(); } + return this._super.apply(this, arguments); }, //-------------------------------------------------------------------------- -- cgit v1.2.3 From 4f9a0cb4fcdfa9fee66c042593f4d411dd0e192f Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Fri, 19 Oct 2018 12:33:27 +0000 Subject: [FIX] website: add some compatibility for old BS3 This commit adds a compatibility file which can be added on demand by enabling its associated view. This will basically map old BS3 classes and structures to the related style with BS4. closes odoo/odoo#27981 --- .../src/scss/compatibility/bs3_for_12_0.scss | 300 +++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 addons/website/static/src/scss/compatibility/bs3_for_12_0.scss (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/scss/compatibility/bs3_for_12_0.scss b/addons/website/static/src/scss/compatibility/bs3_for_12_0.scss new file mode 100644 index 00000000000..82beeec2cbf --- /dev/null +++ b/addons/website/static/src/scss/compatibility/bs3_for_12_0.scss @@ -0,0 +1,300 @@ +/** + * This file's purpose is to *ease* migration from 11.0. + */ + +// Restore gray utilities +$-compat-gray-map: ( + 'gray-darker': '900', + 'gray-dark': '900', + 'gray': '700', + 'gray-light': '600', + 'gray-lighter': '200', +); +@each $old, $new in $-compat-gray-map { + @include bg-variant(".bg-#{$old}", gray($new)); + @include text-emphasis-variant(".text-#{$old}", gray($new)); +} + +// Restore media ? + +// Restore progress bars +@each $color, $value in $theme-colors { + @include bg-variant(".progress-bar-#{$color}", $value); +} + +// Adapt radio ? + +// Adapt labels +.label { + @extend .badge; +} +@each $color, $value in $theme-colors { + .label-#{$color} { + @include badge-variant($value); + } +} +.label-default { + @include badge-variant(theme-color('secondary')); +} + +// Adapt center-block +.center-block { + display: block; + margin: auto; +} + +// Adapt pull-* classes +.pull-left { + float: left; +} +.pull-right { + float: right; +} + +// Adapt pagination +.pagination > li { + @extend .page-item; + > a { + @extend .page-link; + } +} + +// Adapt carousel +.carousel .item { + @extend .carousel-item; +} + +// Adapt checkboxes ? + +// Adapt tables +.table-condensed { + @extend .table-sm; +} + +// Adapt forms +.control-label { + @extend .col-form-label; +} +.help-block { + @extend .form-text; +} +.has-error .form-control { + @extend .is-invalid; +} +.has-success .form-control { + @extend .is-valid; +} +.form-horizontal .form-group { + @extend .row; +} + +// Adapt list-inline +.list-inline > li { + @extend .list-inline-item; +} + +// Adapt list-group +.panel .list-group { + @extend .list-group-flush; +} + +// Adapt image utilies +.img-rounded { + @extend .rounded; +} +.img-circle { + @extend .rounded-circle; +} + +// Adapt input group +.input-group { + .input-group-btn:first-child { + @extend .input-group-prepend; + } + .form-control ~ .input-group-btn { + @extend .input-group-append; + } + .input-group-addon { + @extend .input-group-append; + @extend .input-group-text; + } +} + +// Adapt panels +.panel { + @extend .card; +} +@each $color, $value in $theme-colors { + @include bg-variant(".panel-#{$color}", $value); +} +@include bg-variant(".panel-default", $white); +.panel-heading { + @extend .card-header; +} +.panel-body { + @extend .card-body; +} +.panel-footer { + @extend .card-footer; +} +.well { + @extend .card; + @extend .card-body; +} + +// Adapt grid (push-pull, xs ?) +@each $breakpoint in map-keys($grid-breakpoints) { + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); + $infix: if($infix != "", $infix, "-xs"); + + @include media-breakpoint-up($breakpoint, $grid-breakpoints) { + // `$grid-columns - 1` because offsetting by the width of an entire row isn't possible + @for $i from 0 through ($grid-columns - 1) { + .col#{$infix}-offset-#{$i} { + @include make-col-offset($i, $grid-columns); + } + } + } +} + +// Adapt breadcrumb +.breadcrumb > li { + @extend .breadcrumb-item; +} + +// Adapt nav +.nav > li { + @extend .nav-item; + > a { + @extend .nav-link; + } +} +.nav-stacked { + flex-direction: column; +} +@include bg-variant(".navbar-default", $light); + +// Adapt img-responsive +.img-responsive { + @extend .img-fluid; +} + +// Adapt dropdowns +.dropdown-menu { + a { + @extend .dropdown-item; + } + .divider { + @extend .dropdown-divider; + } +} +.dropdown-toggle .caret { + display: none; +} + +// Adapt buttons +.btn-default { + @include button-variant(theme-color('secondary'), theme-color('secondary')); +} + +// Adapt display classes +.hidden, .hide { + display: none !important; +} +.hidden { + &-xs { + @include media-breakpoint-down(sm) { + display: none; + } + } + &-sm { + @include media-breakpoint-only(md) { + display: none; + } + } + &-md { + @include media-breakpoint-only(lg) { + display: none; + } + } + &-lg { + @include media-breakpoint-only(xl) { + display: none; + } + } + &-print { + @media print { + display: none; + } + } +} +.show { + display: block !important; +} +.visible { + &-xs { + &-block, &-inline-block { + display: none; + } + @include media-breakpoint-down(sm) { + &-block { + display: block; + } + &-inline-block { + display: inline-block; + } + } + } + &-sm { + &-block, &-inline-block { + display: none; + } + @include media-breakpoint-only(md) { + &-block { + display: block; + } + &-inline-block { + display: inline-block; + } + } + } + &-md { + &-block, &-inline-block { + display: none; + } + @include media-breakpoint-only(lg) { + &-block { + display: block; + } + &-inline-block { + display: inline-block; + } + } + } + &-lg { + &-block, &-inline-block { + display: none; + } + @include media-breakpoint-only(xl) { + &-block { + display: block; + } + &-inline-block { + display: inline-block; + } + } + } + &-print { + &-block, &-inline-block { + display: none; + } + @media print { + &-block { + display: block; + } + &-inline-block { + display: inline-block; + } + } + } +} -- cgit v1.2.3 From 51982f9199d2e2e2066507c5d1f12f72ee01facc Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 13 Nov 2018 13:45:12 +0000 Subject: [FIX] website: Impossible to link an analytic account Steps to reproduce the bug: - Go to Website > Dashboard > Analytics and click on "Link my analytics account" - Enter some data and save Bug: A traceback was raised: TypeError: website_set_ga_data() missing 1 required positional argument: 'website_id' opw:1905874 closes odoo/odoo#28636 --- addons/website/static/src/js/backend/dashboard.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/backend/dashboard.js b/addons/website/static/src/js/backend/dashboard.js index b4fe22ba84e..1a83e8dc39a 100644 --- a/addons/website/static/src/js/backend/dashboard.js +++ b/addons/website/static/src/js/backend/dashboard.js @@ -44,6 +44,9 @@ var Dashboard = AbstractAction.extend(ControlPanelMixin, { var self = this; return $.when(ajax.loadLibs(this), this._super()).then(function() { return self.fetch_data(); + }).then(function(){ + var website = _.findWhere(self.websites, {selected: true}); + self.website_id = website ? website.id : false; }); }, -- cgit v1.2.3 From 6b9625e0980ca25163ac2f21157aed4e08f1c1cf Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 14 Nov 2018 10:59:34 +0000 Subject: [FIX] website, *: enforce correct UI text-muted color * web_editor - Restore the preservation of Odoo text-muted color (the rule became !important with BS4 and had thus to become !important in the preservation mixin). - Preserve base design in the "new content" menu (which now uses text-muted). Indeed, in some themes, the "new content" links were not even visible anymore. closes odoo/odoo#28666 --- addons/website/static/src/scss/website.ui.scss | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/scss/website.ui.scss b/addons/website/static/src/scss/website.ui.scss index 1d1c42203b4..d9554a20a1c 100644 --- a/addons/website/static/src/scss/website.ui.scss +++ b/addons/website/static/src/scss/website.ui.scss @@ -298,6 +298,7 @@ body .modal { } #o_new_content_menu_choices { + @include o-w-preserve-base; @include o-position-absolute($o-navbar-height, 0, 0, 0); position: fixed; display: flex; -- cgit v1.2.3 From 931fb8f80ca88623d422173d6c96e5a38c114650 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 14 Nov 2018 14:00:59 +0000 Subject: [FIX] website: recompute auto more menu on window full load The previous code made sure we wait for images to be fully loaded before initializing the auto more menu. But in some cases, it is not enough, we also have to wait for fonts or even extra scripts. Those will have no impact on the feature in most cases though, so we will only update the auto more menu at that time, not wait for it to initialize the feature. closes odoo/odoo#28684 --- addons/website/static/src/js/content/menu.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'addons/website/static/src') diff --git a/addons/website/static/src/js/content/menu.js b/addons/website/static/src/js/content/menu.js index c5371e3c5fb..42a12414557 100644 --- a/addons/website/static/src/js/content/menu.js +++ b/addons/website/static/src/js/content/menu.js @@ -98,6 +98,17 @@ sAnimation.registry.autohideMenu = sAnimation.Class.extend({ def.resolve(); }); }); + + // The previous code will make sure we wait for images to be fully + // loaded before initializing the auto more menu. But in some cases, + // it is not enough, we also have to wait for fonts or even extra + // scripts. Those will have no impact on the feature in most cases + // though, so we will only update the auto more menu at that time, + // no wait for it to initialize the feature. + var $window = $(window); + $window.on('load.autohideMenu', function () { + $window.trigger('resize'); + }); } return $.when.apply($, defs).then(function () { if (!self.noAutohide) { @@ -112,6 +123,7 @@ sAnimation.registry.autohideMenu = sAnimation.Class.extend({ destroy: function () { this._super.apply(this, arguments); if (!this.noAutohide) { + $(window).off('.autohideMenu'); dom.destroyAutoMoreMenu(this.$el); } }, -- cgit v1.2.3