From ac3c1de6374068a102c684f276d0b30d0379388d Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 19 Jan 2017 10:48:49 +0100 Subject: [PATCH] :rewind: Revert v10 migration changes to adapt to v9 again Mostly rename things the other way around than f83647946167a0e08053511eb97b3796ef273118: - __manifest__.py -> __openerp__.py - .o_sub_menu_content -> .oe_secondary_menus_container - .o_sub_menu_logo -> .oe_logo - .o_sub_menu_foote -> .oe_footer - .o_sub_menu -> .oe_leftbar It also includes a complete refactor of #514, to make it work in v9. --- web_responsive/README.rst | 2 +- .../{__manifest__.py => __openerp__.py} | 2 +- .../static/src/js/web_responsive.js | 2 +- web_responsive/static/src/less/form_view.less | 123 ++++++++---------- web_responsive/static/src/less/main.less | 6 +- web_responsive/static/src/less/navbar.less | 2 +- web_responsive/static/src/less/variables.less | 4 + .../static/tests/js/web_responsive.js | 2 +- web_responsive/views/assets.xml | 2 +- web_responsive/views/web.xml | 6 +- 10 files changed, 72 insertions(+), 79 deletions(-) rename web_responsive/{__manifest__.py => __openerp__.py} (95%) diff --git a/web_responsive/README.rst b/web_responsive/README.rst index f9cc7d3f..7981266f 100755 --- a/web_responsive/README.rst +++ b/web_responsive/README.rst @@ -35,7 +35,7 @@ The following keyboard shortcuts are implemented: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/154/10.0 + :target: https://runbot.odoo-community.org/runbot/154/9.0 Known issues / Roadmap ====================== diff --git a/web_responsive/__manifest__.py b/web_responsive/__openerp__.py similarity index 95% rename from web_responsive/__manifest__.py rename to web_responsive/__openerp__.py index 835078bb..4b373601 100755 --- a/web_responsive/__manifest__.py +++ b/web_responsive/__openerp__.py @@ -6,7 +6,7 @@ "name": "Web Responsive", "summary": "It provides a mobile compliant interface for Odoo Community " "web", - "version": "10.0.1.0.0", + "version": "9.0.2.0.0", "category": "Website", "website": "https://laslabs.com/", "author": "LasLabs, Tecnativa, Odoo Community Association (OCA)", diff --git a/web_responsive/static/src/js/web_responsive.js b/web_responsive/static/src/js/web_responsive.js index b1fcd143..0459f7bc 100755 --- a/web_responsive/static/src/js/web_responsive.js +++ b/web_responsive/static/src/js/web_responsive.js @@ -120,7 +120,7 @@ odoo.define('web_responsive', function(require) { // It provides handlers to hide drawer when "unfocused" handleClickZones: function() { this.$el.drawer('close'); - $('.o_sub_menu_content') + $('.oe_secondary_menus_container') .parent() .collapse('hide'); }, diff --git a/web_responsive/static/src/less/form_view.less b/web_responsive/static/src/less/form_view.less index cd6fee23..4ce15fda 100644 --- a/web_responsive/static/src/less/form_view.less +++ b/web_responsive/static/src/less/form_view.less @@ -1,84 +1,73 @@ /* Copyright 2016 Ponto Suprimentos Ltda. * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ -.o_form_view { - > .o_form_sheet_bg > .o_form_sheet { - @media (max-width: @screen-xs-max) { - min-width: 0px; // allow thinner form_sheet width for smaller screens - } - } - @media (max-width: @screen-xs) { - .o_form_field > .o_form_input_dropdown { - width: 80%; +.openerp .oe_formview .oe_form { + // Form must fill 100% width in any size + .oe_form_sheetbg { + padding: 16px; + + .oe_form_sheet_width { + min-width: auto; + max-width: 100%; } } - .o_group { - &.o_inner_group > tbody > tr > td { - // prevent td content from breaking into lines - white-space: nowrap; - .note-editor > .note-toolbar { - // prevent wysiwyg editor buttons from expanding the screen - white-space: initial; - } + + @media (max-width: @screen-sm-max) { + .oe_form_field > .ui-autocomplete-input { + width: 80%; } - // reduce form maximum columns for smaller screens - @media (max-width: @screen-xs-max) { - .o-generate-groups(12); - .o-generate-groups(@n, @i: 1) when (@i =< @n) { - .o_group_col_@{i} { - width: 100%; - } - .o-generate-groups(@n, @i + 1); - } + + .oe_form_group_row .oe_form_group_row { + margin: 0; } - // break field label into a separate line from field on small screens - @media (max-width: @screen-xs) { - &.o_inner_group { + + .oe_form_group, .oe_form_group_row, .oe_form_group_cell { + &, & tbody { display: block; - > tbody { - display: block; - > tr { - margin-top: 8px; - .o-flex-display(); - .o-flex-flow(row, wrap); - > td { - .o-flex(1, 0, auto); - padding: 0; - display: block; - padding: 0; - // odoo adds a `style="width: 100%"` by javascript - // directly on the tag so we need `!important` here: - width: auto!important; - max-width: 100%; - &.o_td_label { - border-right: 0; - // keep 6% space on line to fit checkboxes - // see above about `!important` - width: 94%!important; - } - } + margin-top: 8px; + width: 100%; + } + + &.oe_group_right { + padding: 0; + } + + .oe_form_group_row { + display: table; + } + + .oe_form_group_cell { + margin: 0; + width: 100%; + } + + .oe_form_group_cell_label { + @media (min-width: @screen-sm-min) { + display: table-cell; + min-width: 30%; + width: 30%; + } + + @media (max-width: @screen-xs-max) { + border: none; + } + + + .oe_form_group_cell { + @media (min-width: @screen-sm-min) { + display: table-cell; + max-width: 70%; + width: 70%; } } } } } - // Make image editing controls always available, instead of depending on resolution or hover - .o_form_field_image > .o_form_image_controls { - position: initial; - opacity: 1; - > .fa { - width: 50%; - padding: 6px; - margin: 0px; - text-align: center; - } - > .fa.o_select_file_button { - background: @odoo-brand-primary; - } - > .fa.o_clear_file_button { - background: @brand-danger; - } + // Make image editing controls always available, instead of depending on + // resolution or hover + .oe_form_field_image > .oe_form_field_image_controls { + display: block; + opacity: 0.7; } // Adapt chatter widget to small viewports diff --git a/web_responsive/static/src/less/main.less b/web_responsive/static/src/less/main.less index 0f1c2614..a03ea4a1 100755 --- a/web_responsive/static/src/less/main.less +++ b/web_responsive/static/src/less/main.less @@ -32,11 +32,11 @@ main { } } -.o_sub_menu { - .o_sub_menu_logo { +.oe_leftbar { + .oe_logo { display: none; } - .o_sub_menu_footer { + .oe_footer { display: none; } } diff --git a/web_responsive/static/src/less/navbar.less b/web_responsive/static/src/less/navbar.less index 732e0213..df2c358a 100755 --- a/web_responsive/static/src/less/navbar.less +++ b/web_responsive/static/src/less/navbar.less @@ -101,7 +101,7 @@ header { } } - .o_sub_menu > .o_sub_menu_content > .oe_secondary_menu { + .oe_leftbar > .oe_secondary_menus_container > .oe_secondary_menu { ul.dropdown-menu > li.dropdown-header { color: @odoo-view-background-color; text-decoration: none; diff --git a/web_responsive/static/src/less/variables.less b/web_responsive/static/src/less/variables.less index 34eda0d4..dfb5eb46 100755 --- a/web_responsive/static/src/less/variables.less +++ b/web_responsive/static/src/less/variables.less @@ -9,6 +9,7 @@ // Navbar @navbar-height: 46px; +@navbar-margin-bottom: 0; @app-drawer-navbar-height: @navbar-height / 2; @app-drawer-navbar-padding-vertical: @navbar-padding-vertical / 2; @app-drawer-padding-horizontal: @navbar-padding-horizontal / 2; @@ -16,3 +17,6 @@ // Drawer Toggle @drawer-toggle-height: @navbar-height; @drawer-toggle-width: @navbar-height; + +// Backported from v10 +@odoo-list-footer-bg-color: #eee; diff --git a/web_responsive/static/tests/js/web_responsive.js b/web_responsive/static/tests/js/web_responsive.js index 686fce3f..c1f96196 100755 --- a/web_responsive/static/tests/js/web_responsive.js +++ b/web_responsive/static/tests/js/web_responsive.js @@ -23,7 +23,7 @@ odoo.define_section('web_responsive', ['web_responsive'], function(test) { self.$clickZone = $(''); - self.$secondaryMenu = $('
'); + self.$secondaryMenu = $('
'); self.$dropdown = $('