3
0
Fork 0

[IMP] pre-commit run after update

Includes some manual fixes to silent ESLint warnings.
14.0
Jairo Llopis 2020-01-24 13:45:39 +00:00 committed by Splash
parent 1651d7c137
commit 3a223fa490
9 changed files with 305 additions and 274 deletions

View File

@ -42,8 +42,7 @@ $chatter_zone_width: 35%;
} }
.o_menu_sections, .o_menu_sections,
.o_menu_systray, .o_menu_systray {
{
padding: 0; padding: 0;
} }
} }
@ -56,8 +55,7 @@ $chatter_zone_width: 35%;
// Hide big things // Hide big things
.o_menu_brand, .o_menu_brand,
.o_menu_sections, .o_menu_sections,
.oe_topbar_name, .oe_topbar_name {
{
display: none; display: none;
} }
@ -85,8 +83,7 @@ $chatter_zone_width: 35%;
> li, > li,
.o_menu_entry_lvl_1, .o_menu_entry_lvl_1,
.o_menu_header_lvl_1, .o_menu_header_lvl_1 {
{
// Homogeneous background color // Homogeneous background color
background-color: $dropdown-bg; background-color: $dropdown-bg;
color: $dropdown-link-color; color: $dropdown-link-color;
@ -137,7 +134,6 @@ $chatter_zone_width: 35%;
// Iconized full screen apps menu // Iconized full screen apps menu
.o_menu_apps { .o_menu_apps {
.search-input:focus { .search-input:focus {
border-color: $o-brand-primary; border-color: $o-brand-primary;
} }
@ -238,8 +234,7 @@ html .o_web_client .o_action_manager .o_action {
.o_cp_buttons, .o_cp_buttons,
.o_cp_left, .o_cp_left,
.o_cp_right, .o_cp_right,
.o_cp_searchview, .o_cp_searchview {
{
flex: 1 1 100%; flex: 1 1 100%;
@include media-breakpoint-up(md) { @include media-breakpoint-up(md) {
flex-basis: 50%; flex-basis: 50%;
@ -251,8 +246,7 @@ html .o_web_client .o_action_manager .o_action {
} }
.o_cp_searchview, .o_cp_searchview,
.o_cp_right, .o_cp_right {
{
flex-basis: 10%; flex-basis: 10%;
} }
@ -276,7 +270,7 @@ html .o_web_client .o_action_manager .o_action {
padding-right: 0; padding-right: 0;
} }
&:nth-last-of-type(1n+3) { &:nth-last-of-type(1n + 3) {
display: none; display: none;
} }
@ -333,7 +327,8 @@ html .o_web_client .o_action_manager .o_action {
} }
// Normal views // Normal views
.o_content, .modal-content { .o_content,
.modal-content {
max-width: 100%; max-width: 100%;
// Form views // Form views
@ -380,14 +375,13 @@ html .o_web_client .o_action_manager .o_action {
.oe_button_box { .oe_button_box {
.o_dropdown_more { .o_dropdown_more {
button:last-child { button:last-child {
border-right: 1px solid gray('400'); border-right: 1px solid gray("400");
} }
} }
} }
// Avoid overflow on forms with title and/or button box // Avoid overflow on forms with title and/or button box
.oe_title, .oe_title {
{
max-width: 100%; max-width: 100%;
} }
@ -442,8 +436,7 @@ html .o_web_client .o_action_manager .o_action {
// Full width in form sheets // Full width in form sheets
.o_form_sheet, .o_form_sheet,
.oe_chatter, .oe_chatter {
{
min-width: auto; min-width: auto;
max-width: 98%; max-width: 98%;
} }
@ -460,7 +453,7 @@ html .o_web_client .o_action_manager .o_action {
// Display send button on small screens // Display send button on small screens
.o_thread_composer { .o_thread_composer {
padding-left: $o-mail-thread-avatar-size*0.5; padding-left: $o-mail-thread-avatar-size * 0.5;
.o_composer_button_send { .o_composer_button_send {
display: initial !important; // Forced in core display: initial !important; // Forced in core
@ -508,7 +501,7 @@ html .o_web_client .o_action_manager .o_action {
} }
.o_chatter { .o_chatter {
border-left: 1px solid gray('400'); border-left: 1px solid gray("400");
flex: 0 0 $chatter_zone_width; flex: 0 0 $chatter_zone_width;
max-width: initial; max-width: initial;
min-width: initial; min-width: initial;
@ -544,10 +537,11 @@ html .o_web_client .o_action_manager .o_action {
// Sticky Header & Footer in List View // Sticky Header & Footer in List View
.o_list_view { .o_list_view {
.table-responsive { .table-responsive {
.o_list_table { .o_list_table {
// th & td are here for compatibility with chrome // th & td are here for compatibility with chrome
thead, thead tr:nth-child(1) th { thead,
thead tr:nth-child(1) th {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 1; z-index: 1;
@ -555,7 +549,8 @@ html .o_web_client .o_action_manager .o_action {
thead tr:nth-child(1) th { thead tr:nth-child(1) th {
background-color: $o-list-footer-bg-color; background-color: $o-list-footer-bg-color;
} }
tfoot, tfoot tr:nth-child(1) td { tfoot,
tfoot tr:nth-child(1) td {
position: sticky; position: sticky;
bottom: 0; bottom: 0;
} }
@ -568,7 +563,7 @@ html .o_web_client .o_action_manager .o_action {
// Waiting Cursor // Waiting Cursor
.oe_wait { .oe_wait {
cursor: progress; cursor: progress;
} }
// Document Viewer // Document Viewer
@ -585,10 +580,12 @@ html .o_web_client .o_action_manager .o_action {
right: 0; right: 0;
/* Show/Hide control buttons (next, prev, etc..) */ /* Show/Hide control buttons (next, prev, etc..) */
&:hover .arrow, &:hover .o_viewer_toolbar { &:hover .arrow,
&:hover .o_viewer_toolbar {
display: flex; display: flex;
} }
.arrow, .o_viewer_toolbar { .arrow,
.o_viewer_toolbar {
display: none; display: none;
} }
@ -611,7 +608,8 @@ html .o_web_client .o_action_manager .o_action {
} }
} }
@include media-breakpoint-down(lg) { @include media-breakpoint-down(lg) {
.o_minimize_btn, .o_maximize_btn { .o_minimize_btn,
.o_maximize_btn {
display: none; display: none;
} }
} }
@ -619,7 +617,8 @@ html .o_web_client .o_action_manager .o_action {
} }
/* Max/Min buttons only are usefull in sided mode */ /* Max/Min buttons only are usefull in sided mode */
.o_web_client:not(.o_chatter_position_sided) { .o_web_client:not(.o_chatter_position_sided) {
.o_minimize_btn, .o_maximize_btn { .o_minimize_btn,
.o_maximize_btn {
display: none; display: none;
} }
} }

View File

@ -1,28 +1,28 @@
/* Copyright 2018 Tecnativa - Jairo Llopis /* Copyright 2018 Tecnativa - Jairo Llopis
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ * License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
odoo.define('web_responsive', function (require) { odoo.define("web_responsive", function(require) {
'use strict'; "use strict";
const ActionManager = require('web.ActionManager'); const ActionManager = require("web.ActionManager");
const AbstractWebClient = require("web.AbstractWebClient"); const AbstractWebClient = require("web.AbstractWebClient");
const AppsMenu = require("web.AppsMenu"); const AppsMenu = require("web.AppsMenu");
const BasicController = require('web.BasicController'); const BasicController = require("web.BasicController");
const config = require("web.config"); const config = require("web.config");
const core = require("web.core"); const core = require("web.core");
const FormRenderer = require('web.FormRenderer'); const FormRenderer = require("web.FormRenderer");
const Menu = require("web.Menu"); const Menu = require("web.Menu");
const RelationalFields = require('web.relational_fields'); const RelationalFields = require("web.relational_fields");
const Chatter = require('mail.Chatter'); const Chatter = require("mail.Chatter");
const ListRenderer = require('web.ListRenderer'); const ListRenderer = require("web.ListRenderer");
const DocumentViewer = require('mail.DocumentViewer'); const DocumentViewer = require("mail.DocumentViewer");
/* /*
* Helper function to know if are waiting * Helper function to know if are waiting
* *
*/ */
function isWaiting () { function isWaiting() {
return $('.oe_wait').length !== 0; return $(".oe_wait").length !== 0;
} }
/** /**
@ -70,7 +70,7 @@ odoo.define('web_responsive', function (require) {
* } * }
* ``` * ```
*/ */
function findNames (memo, menu) { function findNames(memo, menu) {
if (menu.action) { if (menu.action) {
var key = menu.parent_id ? menu.parent_id[1] + "/" : ""; var key = menu.parent_id ? menu.parent_id[1] + "/" : "";
memo[key + menu.name] = menu; memo[key + menu.name] = menu;
@ -82,33 +82,31 @@ odoo.define('web_responsive', function (require) {
} }
AppsMenu.include({ AppsMenu.include({
events: _.extend({ events: _.extend(
"keydown .search-input input": "_searchResultsNavigate", {
"input .search-input input": "_searchMenusSchedule", "keydown .search-input input": "_searchResultsNavigate",
"click .o-menu-search-result": "_searchResultChosen", "input .search-input input": "_searchMenusSchedule",
"shown.bs.dropdown": "_searchFocus", "click .o-menu-search-result": "_searchResultChosen",
"hidden.bs.dropdown": "_searchReset", "shown.bs.dropdown": "_searchFocus",
"hide.bs.dropdown": "_hideAppsMenu", "hidden.bs.dropdown": "_searchReset",
}, AppsMenu.prototype.events), "hide.bs.dropdown": "_hideAppsMenu",
},
AppsMenu.prototype.events
),
/** /**
* Rescue some menu data stripped out in original method. * Rescue some menu data stripped out in original method.
* *
* @override * @override
*/ */
init: function (parent, menuData) { init: function(parent, menuData) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
// Keep base64 icon for main menus // Keep base64 icon for main menus
for (let n in this._apps) { for (const n in this._apps) {
this._apps[n].web_icon_data = this._apps[n].web_icon_data = menuData.children[n].web_icon_data;
menuData.children[n].web_icon_data;
} }
// Store menu data in a format searchable by fuzzy.js // Store menu data in a format searchable by fuzzy.js
this._searchableMenus = _.reduce( this._searchableMenus = _.reduce(menuData.children, findNames, {});
menuData.children,
findNames,
{}
);
// Search only after timeout, for fast typers // Search only after timeout, for fast typers
this._search_def = false; this._search_def = false;
}, },
@ -116,7 +114,7 @@ odoo.define('web_responsive', function (require) {
/** /**
* @override * @override
*/ */
start: function () { start: function() {
this.$search_container = this.$(".search-container"); this.$search_container = this.$(".search-container");
this.$search_input = this.$(".search-input input"); this.$search_input = this.$(".search-input input");
this.$search_results = this.$(".search-results"); this.$search_results = this.$(".search-results");
@ -128,7 +126,7 @@ odoo.define('web_responsive', function (require) {
* *
* @override * @override
*/ */
_onAppsMenuItemClicked: function (ev) { _onAppsMenuItemClicked: function(ev) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
ev.preventDefault(); ev.preventDefault();
}, },
@ -142,17 +140,20 @@ odoo.define('web_responsive', function (require) {
* @returns {Object} * @returns {Object}
* Menu definition, plus extra needed keys. * Menu definition, plus extra needed keys.
*/ */
_menuInfo: function (key) { _menuInfo: function(key) {
const original = this._searchableMenus[key]; const original = this._searchableMenus[key];
return _.extend({ return _.extend(
action_id: parseInt(original.action.split(',')[1], 10), {
}, original); action_id: parseInt(original.action.split(",")[1], 10),
},
original
);
}, },
/** /**
* Autofocus on search field on big screens. * Autofocus on search field on big screens.
*/ */
_searchFocus: function () { _searchFocus: function() {
if (!config.device.isMobile) { if (!config.device.isMobile) {
this.$search_input.focus(); this.$search_input.focus();
} }
@ -161,7 +162,7 @@ odoo.define('web_responsive', function (require) {
/** /**
* Reset search input and results * Reset search input and results
*/ */
_searchReset: function () { _searchReset: function() {
this.$search_container.removeClass("has-results"); this.$search_container.removeClass("has-results");
this.$search_results.empty(); this.$search_results.empty();
this.$search_input.val(""); this.$search_input.val("");
@ -170,8 +171,8 @@ odoo.define('web_responsive', function (require) {
/** /**
* Schedule a search on current menu items. * Schedule a search on current menu items.
*/ */
_searchMenusSchedule: function () { _searchMenusSchedule: function() {
this._search_def = new Promise((resolve) => { this._search_def = new Promise(resolve => {
setTimeout(resolve, 50); setTimeout(resolve, 50);
}); });
this._search_def.then(this._searchMenus.bind(this)); this._search_def.then(this._searchMenus.bind(this));
@ -180,33 +181,23 @@ odoo.define('web_responsive', function (require) {
/** /**
* Search among available menu items, and render that search. * Search among available menu items, and render that search.
*/ */
_searchMenus: function () { _searchMenus: function() {
const query = this.$search_input.val(); const query = this.$search_input.val();
if (query === "") { if (query === "") {
this.$search_container.removeClass("has-results"); this.$search_container.removeClass("has-results");
this.$search_results.empty(); this.$search_results.empty();
return; return;
} }
var results = fuzzy.filter( var results = fuzzy.filter(query, _.keys(this._searchableMenus), {
query, pre: "<b>",
_.keys(this._searchableMenus), post: "</b>",
{ });
pre: "<b>", this.$search_container.toggleClass("has-results", Boolean(results.length));
post: "</b>",
}
);
this.$search_container.toggleClass(
"has-results",
Boolean(results.length)
);
this.$search_results.html( this.$search_results.html(
core.qweb.render( core.qweb.render("web_responsive.MenuSearchResults", {
"web_responsive.MenuSearchResults", results: results,
{ widget: this,
results: results, })
widget: this,
}
)
); );
}, },
@ -215,7 +206,7 @@ odoo.define('web_responsive', function (require) {
* *
* @param {jQuery.Event} event * @param {jQuery.Event} event
*/ */
_searchResultChosen: function (event) { _searchResultChosen: function(event) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
const $result = $(event.currentTarget), const $result = $(event.currentTarget),
@ -229,7 +220,7 @@ odoo.define('web_responsive', function (require) {
previous_menu_id: data.parentId, previous_menu_id: data.parentId,
}); });
// Find app that owns the chosen menu // Find app that owns the chosen menu
const app = _.find(this._apps, function (_app) { const app = _.find(this._apps, function(_app) {
return text.indexOf(_app.name + suffix) === 0; return text.indexOf(_app.name + suffix) === 0;
}); });
// Update navbar menus // Update navbar menus
@ -241,7 +232,7 @@ odoo.define('web_responsive', function (require) {
* *
* @param {jQuery.Event} event * @param {jQuery.Event} event
*/ */
_searchResultsNavigate: function (event) { _searchResultsNavigate: function(event) {
// Find current results and active element (1st by default) // Find current results and active element (1st by default)
const all = this.$search_results.find(".o-menu-search-result"), const all = this.$search_results.find(".o-menu-search-result"),
pre_focused = all.filter(".active") || $(all[0]); pre_focused = all.filter(".active") || $(all[0]);
@ -257,20 +248,20 @@ odoo.define('web_responsive', function (require) {
key = event.shiftKey ? "ArrowUp" : "ArrowDown"; key = event.shiftKey ? "ArrowUp" : "ArrowDown";
} }
switch (key) { switch (key) {
// Pressing enter is the same as clicking on the active element // Pressing enter is the same as clicking on the active element
case "Enter": case "Enter":
pre_focused.click(); pre_focused.click();
break; break;
// Navigate up or down // Navigate up or down
case "ArrowUp": case "ArrowUp":
offset--; offset--;
break; break;
case "ArrowDown": case "ArrowDown":
offset++; offset++;
break; break;
default: default:
// Other keys are useless in this event // Other keys are useless in this event
return; return;
} }
// Allow looping on results // Allow looping on results
if (offset < 0) { if (offset < 0) {
@ -290,44 +281,45 @@ odoo.define('web_responsive', function (require) {
}, },
/* /*
* Control if AppDrawer can be closed * Control if AppDrawer can be closed
*/ */
_hideAppsMenu: function () { _hideAppsMenu: function() {
return !isWaiting() && !this.$('input').is(':focus'); return !isWaiting() && !this.$("input").is(":focus");
}, },
}); });
BasicController.include({ BasicController.include({
/** /**
* Close the AppDrawer if the data set is dirty and a discard dialog * Close the AppDrawer if the data set is dirty and a discard dialog
* is opened * is opened
* *
* @override * @override
*/ */
canBeDiscarded: function (recordID) { canBeDiscarded: function(recordID) {
if (this.model.isDirty(recordID || this.handle)) { if (this.model.isDirty(recordID || this.handle)) {
$('.o_menu_apps .dropdown:has(.dropdown-menu.show) > a') $(".o_menu_apps .dropdown:has(.dropdown-menu.show) > a").dropdown(
.dropdown('toggle'); "toggle"
$('.o_menu_sections li.show .dropdown-toggle') );
.dropdown('toggle'); $(".o_menu_sections li.show .dropdown-toggle").dropdown("toggle");
} }
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
}); });
Menu.include({ Menu.include({
events: _.extend({ events: _.extend(
// Clicking a hamburger menu item should close the hamburger {
"click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus", // Clicking a hamburger menu item should close the hamburger
// Opening any dropdown in the navbar should hide the hamburger "click .o_menu_sections [role=menuitem]": "_hideMobileSubmenus",
"show.bs.dropdown .o_menu_systray, .o_menu_apps": // Opening any dropdown in the navbar should hide the hamburger
"_hideMobileSubmenus", "show.bs.dropdown .o_menu_systray, .o_menu_apps": "_hideMobileSubmenus",
// Prevent close section menu // Prevent close section menu
"hide.bs.dropdown .o_menu_sections": "_hideMenuSection", "hide.bs.dropdown .o_menu_sections": "_hideMenuSection",
}, Menu.prototype.events), },
Menu.prototype.events
),
start: function () { start: function() {
this.$menu_toggle = this.$(".o-menu-toggle"); this.$menu_toggle = this.$(".o-menu-toggle");
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
@ -335,7 +327,7 @@ odoo.define('web_responsive', function (require) {
/** /**
* Hide menus for current app if you're in mobile * Hide menus for current app if you're in mobile
*/ */
_hideMobileSubmenus: function () { _hideMobileSubmenus: function() {
if ( if (
this.$menu_toggle.is(":visible") && this.$menu_toggle.is(":visible") &&
this.$section_placeholder.is(":visible") && this.$section_placeholder.is(":visible") &&
@ -350,7 +342,7 @@ odoo.define('web_responsive', function (require) {
* *
* @returns {Boolean} * @returns {Boolean}
*/ */
_hideMenuSection: function () { _hideMenuSection: function() {
return !isWaiting(); return !isWaiting();
}, },
@ -359,7 +351,7 @@ odoo.define('web_responsive', function (require) {
* *
* @override * @override
*/ */
_updateMenuBrand: function () { _updateMenuBrand: function() {
if (!config.device.isMobile) { if (!config.device.isMobile) {
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
} }
@ -370,7 +362,7 @@ odoo.define('web_responsive', function (require) {
* *
* @override * @override
*/ */
_onMouseOverMenu: function () { _onMouseOverMenu: function() {
if (!isWaiting()) { if (!isWaiting()) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
} }
@ -378,16 +370,15 @@ odoo.define('web_responsive', function (require) {
}); });
RelationalFields.FieldStatus.include({ RelationalFields.FieldStatus.include({
/** /**
* Fold all on mobiles. * Fold all on mobiles.
* *
* @override * @override
*/ */
_setState: function () { _setState: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
if (config.device.isMobile) { if (config.device.isMobile) {
_.map(this.status_information, (value) => { _.map(this.status_information, value => {
value.fold = true; value.fold = true;
}); });
} }
@ -396,19 +387,20 @@ odoo.define('web_responsive', function (require) {
// Sticky Column Selector // Sticky Column Selector
ListRenderer.include({ ListRenderer.include({
_renderView: function () { _renderView: function() {
const self = this; const self = this;
return this._super.apply(this, arguments).then(() => { return this._super.apply(this, arguments).then(() => {
const $col_selector = self.$el.find( const $col_selector = self.$el.find(
'.o_optional_columns_dropdown_toggle'); ".o_optional_columns_dropdown_toggle"
);
if ($col_selector.length !== 0) { if ($col_selector.length !== 0) {
const $th = self.$el.find('thead>tr:first>th:last'); const $th = self.$el.find("thead>tr:first>th:last");
$col_selector.appendTo($th); $col_selector.appendTo($th);
} }
}); });
}, },
_onToggleOptionalColumnDropdown: function (ev) { _onToggleOptionalColumnDropdown: function(ev) {
// FIXME: For some strange reason the 'stopPropagation' call // FIXME: For some strange reason the 'stopPropagation' call
// in the main method don't work. Invoking here the same method // in the main method don't work. Invoking here the same method
// does the expected behavior... O_O! // does the expected behavior... O_O!
@ -421,13 +413,12 @@ odoo.define('web_responsive', function (require) {
// Responsive view "action" buttons // Responsive view "action" buttons
FormRenderer.include({ FormRenderer.include({
/** /**
* In mobiles, put all statusbar buttons in a dropdown. * In mobiles, put all statusbar buttons in a dropdown.
* *
* @override * @override
*/ */
_renderHeaderButtons: function () { _renderHeaderButtons: function() {
const $buttons = this._super.apply(this, arguments); const $buttons = this._super.apply(this, arguments);
if ( if (
!config.device.isMobile || !config.device.isMobile ||
@ -438,9 +429,9 @@ odoo.define('web_responsive', function (require) {
// $buttons must be appended by JS because all events are bound // $buttons must be appended by JS because all events are bound
$buttons.addClass("dropdown-menu"); $buttons.addClass("dropdown-menu");
const $dropdown = $(core.qweb.render( const $dropdown = $(
'web_responsive.MenuStatusbarButtons' core.qweb.render("web_responsive.MenuStatusbarButtons")
)); );
$buttons.addClass("dropdown-menu").appendTo($dropdown); $buttons.addClass("dropdown-menu").appendTo($dropdown);
return $dropdown; return $dropdown;
}, },
@ -448,10 +439,12 @@ odoo.define('web_responsive', function (require) {
// Chatter Hide Composer // Chatter Hide Composer
Chatter.include({ Chatter.include({
_openComposer: function (options) { _openComposer: function(options) {
if (this._composer && if (
options.isLog === this._composer.options.isLog && this._composer &&
this._composer.$el.is(':visible')) { options.isLog === this._composer.options.isLog &&
this._composer.$el.is(":visible")
) {
this._closeComposer(false); this._closeComposer(false);
} else { } else {
this._super.apply(this, arguments); this._super.apply(this, arguments);
@ -461,37 +454,43 @@ odoo.define('web_responsive', function (require) {
// Hide AppDrawer or Menu when the action has been completed // Hide AppDrawer or Menu when the action has been completed
ActionManager.include({ ActionManager.include({
/** /**
* Because the menu aren't closed when click, this method * Because the menu aren't closed when click, this method
* searchs for the menu with the action executed to close it. * searchs for the menu with the action executed to close it.
* To avoid delays in pages with a lot of DOM nodes we make * To avoid delays in pages with a lot of DOM nodes we make
* 'sub-groups' with 'querySelector' to improve the performance. * 'sub-groups' with 'querySelector' to improve the performance.
* *
* @param {action} action * @param {action} action
* The executed action * The executed action
*/ */
_hideMenusByAction: function (action) { _hideMenusByAction: function(action) {
const uniq_sel = '[data-action-id='+action.id+']'; const uniq_sel = "[data-action-id=" + action.id + "]";
// Need close AppDrawer? // Need close AppDrawer?
const menu_apps_dropdown = document.querySelector( const menu_apps_dropdown = document.querySelector(".o_menu_apps .dropdown");
'.o_menu_apps .dropdown'); $(menu_apps_dropdown)
$(menu_apps_dropdown).has('.dropdown-menu.show') .has(".dropdown-menu.show")
.has(uniq_sel).find('> a').dropdown('toggle'); .has(uniq_sel)
.find("> a")
.dropdown("toggle");
// Need close Sections Menu? // Need close Sections Menu?
const menu_sections = document.querySelector( const menu_sections = document.querySelector(".o_menu_sections li.show");
'.o_menu_sections li.show'); $(menu_sections)
$(menu_sections).has(uniq_sel).find('.dropdown-toggle') .has(uniq_sel)
.dropdown('toggle'); .find(".dropdown-toggle")
.dropdown("toggle");
// Need close Mobile? // Need close Mobile?
const menu_sections_mobile = document.querySelector( const menu_sections_mobile = document.querySelector(
'.o_menu_sections.show'); ".o_menu_sections.show"
$(menu_sections_mobile).has(uniq_sel).hide(); );
$(menu_sections_mobile)
.has(uniq_sel)
.hide();
}, },
_handleAction: function (action) { _handleAction: function(action) {
return this._super.apply(this, arguments).finally( return this._super
$.proxy(this, '_hideMenusByAction', action)); .apply(this, arguments)
.finally($.proxy(this, "_hideMenusByAction", action));
}, },
}); });
@ -508,7 +507,6 @@ odoo.define('web_responsive', function (require) {
* enable this behavior. * enable this behavior.
*/ */
var KeyboardNavigationShiftAltMixin = { var KeyboardNavigationShiftAltMixin = {
/** /**
* Alter the key event to require pressing Shift. * Alter the key event to require pressing Shift.
* *
@ -526,7 +524,7 @@ odoo.define('web_responsive', function (require) {
* @returns {keyEvent} * @returns {keyEvent}
* Altered event object * Altered event object
*/ */
_shiftPressed: function (keyEvent) { _shiftPressed: function(keyEvent) {
const alt = keyEvent.altKey || keyEvent.key === "Alt", const alt = keyEvent.altKey || keyEvent.key === "Alt",
newEvent = _.extend({}, keyEvent), newEvent = _.extend({}, keyEvent),
shift = keyEvent.shiftKey || keyEvent.key === "Shift"; shift = keyEvent.shiftKey || keyEvent.key === "Shift";
@ -540,11 +538,11 @@ odoo.define('web_responsive', function (require) {
return newEvent; return newEvent;
}, },
_onKeyDown: function (keyDownEvent) { _onKeyDown: function(keyDownEvent) {
return this._super(this._shiftPressed(keyDownEvent)); return this._super(this._shiftPressed(keyDownEvent));
}, },
_onKeyUp: function (keyUpEvent) { _onKeyUp: function(keyUpEvent) {
return this._super(this._shiftPressed(keyUpEvent)); return this._super(this._shiftPressed(keyUpEvent));
}, },
}; };
@ -559,38 +557,38 @@ odoo.define('web_responsive', function (require) {
// this.$el is active, but now the modal have buttons that can obtain // this.$el is active, but now the modal have buttons that can obtain
// the focus. For this reason we now listen core events, that are // the focus. For this reason we now listen core events, that are
// dispatched every time. // dispatched every time.
events: _.extend(_.omit(DocumentViewer.prototype.events, [ events: _.extend(
'keydown', _.omit(DocumentViewer.prototype.events, ["keydown", "keyup"]),
'keyup', {
]), { "click .o_maximize_btn": "_onClickMaximize",
'click .o_maximize_btn': '_onClickMaximize', "click .o_minimize_btn": "_onClickMinimize",
'click .o_minimize_btn': '_onClickMinimize', "shown.bs.modal": "_onShownModal",
'shown.bs.modal': '_onShownModal', }
}), ),
start: function () { start: function() {
core.bus.on('keydown', this, this._onKeydown); core.bus.on("keydown", this, this._onKeydown);
core.bus.on('keyup', this, this._onKeyUp); core.bus.on("keyup", this, this._onKeyUp);
return this._super.apply(this, arguments); return this._super.apply(this, arguments);
}, },
destroy: function () { destroy: function() {
core.bus.off('keydown', this, this._onKeydown); core.bus.off("keydown", this, this._onKeydown);
core.bus.off('keyup', this, this._onKeyUp); core.bus.off("keyup", this, this._onKeyUp);
this._super.apply(this, arguments); this._super.apply(this, arguments);
}, },
_onShownModal: function () { _onShownModal: function() {
// Disable auto-focus to allow to use controls in edit mode. // Disable auto-focus to allow to use controls in edit mode.
// This only affects the active modal. // This only affects the active modal.
// More info: https://stackoverflow.com/a/14795256 // More info: https://stackoverflow.com/a/14795256
$(document).off('focusin.modal'); $(document).off("focusin.modal");
}, },
_onClickMaximize: function () { _onClickMaximize: function() {
this.$el.removeClass('o_responsive_document_viewer'); this.$el.removeClass("o_responsive_document_viewer");
}, },
_onClickMinimize: function () { _onClickMinimize: function() {
this.$el.addClass('o_responsive_document_viewer'); this.$el.addClass("o_responsive_document_viewer");
}, },
}); });
}); });

View File

@ -1,17 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2018 Tecnativa - Jairo Llopis <!-- Copyright 2018 Tecnativa - Jairo Llopis
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<template> <template>
<t t-extend="AppsMenu"> <t t-extend="AppsMenu">
<!-- App icons must be clickable --> <!-- App icons must be clickable -->
<t t-jquery=".o_app" t-operation="attributes"> <t t-jquery=".o_app" t-operation="attributes">
<attribute name="t-attf-href">#menu_id=#{app.menuID}&amp;action_id=#{app.actionID}</attribute> <attribute
name="t-attf-href"
>#menu_id=#{app.menuID}&amp;action_id=#{app.actionID}</attribute>
</t> </t>
<!-- App icons should be more than a text --> <!-- App icons should be more than a text -->
<t t-jquery=".o_app &gt; t" t-operation="replace"> <t t-jquery=".o_app &gt; t" t-operation="replace">
<t t-call="web_responsive.AppIcon"/> <t t-call="web_responsive.AppIcon" />
</t> </t>
<!-- Same hotkey as in EE --> <!-- Same hotkey as in EE -->
@ -26,40 +27,46 @@
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<div class="input-group-text"> <div class="input-group-text">
<i class="fa fa-search"/> <i class="fa fa-search" />
</div> </div>
</div> </div>
<input type="search" <input
autocomplete="off" type="search"
placeholder="Search menus..." autocomplete="off"
class="form-control"/> placeholder="Search menus..."
class="form-control"
/>
</div> </div>
</div> </div>
<div class="search-results col-md-10 ml-auto mr-auto"/> <div class="search-results col-md-10 ml-auto mr-auto" />
</div> </div>
</t> </t>
</t> </t>
<!-- Separate app icon template, for easier inheritance --> <!-- Separate app icon template, for easier inheritance -->
<t t-name="web_responsive.AppIcon"> <t t-name="web_responsive.AppIcon">
<img class="o-app-icon" <img
t-attf-src="data:image/png;base64,#{app.web_icon_data}"/> class="o-app-icon"
t-attf-src="data:image/png;base64,#{app.web_icon_data}"
/>
<span class="o-app-name"> <span class="o-app-name">
<t t-esc="app.name"/> <t t-esc="app.name" />
</span> </span>
</t> </t>
<!-- A search result --> <!-- A search result -->
<t t-name="web_responsive.MenuSearchResults"> <t t-name="web_responsive.MenuSearchResults">
<t t-foreach="results" t-as="result"> <t t-foreach="results" t-as="result">
<t t-set="menu" t-value="widget._menuInfo(result.original)"/> <t t-set="menu" t-value="widget._menuInfo(result.original)" />
<a t-attf-class="o-menu-search-result dropdown-item col-12 ml-auto mr-auto #{result_first ? 'active' : ''}" <a
t-attf-style="background-image:url('data:image/png;base64,#{menu.web_icon_data}')" t-attf-class="o-menu-search-result dropdown-item col-12 ml-auto mr-auto #{result_first ? 'active' : ''}"
t-attf-href="#menu_id=#{menu.id}&amp;action_id=#{menu.action_id}" t-attf-style="background-image:url('data:image/png;base64,#{menu.web_icon_data}')"
t-att-data-menu-id="menu.id" t-attf-href="#menu_id=#{menu.id}&amp;action_id=#{menu.action_id}"
t-att-data-action-id="menu.action_id" t-att-data-menu-id="menu.id"
t-att-data-parent-id="menu.parent_id[0]" t-att-data-action-id="menu.action_id"
t-raw="result.string"/> t-att-data-parent-id="menu.parent_id[0]"
t-raw="result.string"
/>
</t> </t>
</t> </t>
</template> </template>

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2019 Tecnativa - Alexandre Díaz <!-- Copyright 2019 Tecnativa - Alexandre Díaz
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<template> <template>
<t t-extend="DocumentViewer"> <t t-extend="DocumentViewer">
<t t-jquery=".o_modal_fullscreen" t-operation="attributes"> <t t-jquery=".o_modal_fullscreen" t-operation="attributes">
<attribute name="class">modal o_modal_fullscreen o_document_viewer o_responsive_document_viewer</attribute> <attribute
name="class"
>modal o_modal_fullscreen o_document_viewer o_responsive_document_viewer</attribute>
<attribute name="data-backdrop">false</attribute> <attribute name="data-backdrop">false</attribute>
</t> </t>
</t> </t>
@ -13,9 +14,27 @@
<t t-extend="DocumentViewer.Content"> <t t-extend="DocumentViewer.Content">
<t t-jquery=".o_close_btn" t-operation="replace"> <t t-jquery=".o_close_btn" t-operation="replace">
<div class="o_buttons float-right mr8"> <div class="o_buttons float-right mr8">
<a role="button" class="mr8 o_maximize_btn" tabindex="0" aria-label="Maximize" title="Maximize"><i class="fa fa-window-maximize"></i></a> <a
<a role="button" class="mr8 o_minimize_btn" tabindex="0" aria-label="Minimize" title="Minimize"><i class="fa fa-window-minimize"></i></a> role="button"
<a role="button" class="o_close_btn" tabindex="0" aria-label="Close" title="Close"><i class="fa fa-close"></i></a> class="mr8 o_maximize_btn"
tabindex="0"
aria-label="Maximize"
title="Maximize"
><i class="fa fa-window-maximize" /></a>
<a
role="button"
class="mr8 o_minimize_btn"
tabindex="0"
aria-label="Minimize"
title="Minimize"
><i class="fa fa-window-minimize" /></a>
<a
role="button"
class="o_close_btn"
tabindex="0"
aria-label="Close"
title="Close"
><i class="fa fa-close" /></a>
</div> </div>
</t> </t>
</t> </t>

View File

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<!-- <!--
Copyright 2017 LasLabs Inc. Copyright 2017 LasLabs Inc.
Copyright 2018 Alexandre Díaz Copyright 2018 Alexandre Díaz
Copyright 2018 Tecnativa - Jairo Llopis Copyright 2018 Tecnativa - Jairo Llopis
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
--> -->
<templates id="form_view" xml:space="preserve"> <templates id="form_view" xml:space="preserve">
<!-- Template for buttons that display only the icon in xs --> <!-- Template for buttons that display only the icon in xs -->
<t t-name="web_responsive.icon_button"> <t t-name="web_responsive.icon_button">
<i t-attf-class="fa fa-#{icon}" <i t-attf-class="fa fa-#{icon}" t-att-title="label" />
t-att-title="label"/> <span class="d-none d-sm-inline" t-esc="label" />
<span class="d-none d-sm-inline" t-esc="label"/>
</t> </t>
<t t-name="web_responsive.MenuStatusbarButtons"> <t t-name="web_responsive.MenuStatusbarButtons">
<div class="dropdown"> <div class="dropdown">
<button class="o_statusbar_buttons_dropdown btn btn-secondary dropdown-toggle" <button
type="button" class="o_statusbar_buttons_dropdown btn btn-secondary dropdown-toggle"
data-toggle="dropdown" type="button"
aria-haspopup="true" data-toggle="dropdown"
aria-expanded="false"> aria-haspopup="true"
aria-expanded="false"
>
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'cogs'"/> <t t-set="icon" t-value="'cogs'" />
<t t-set="label">Quick actions</t> <t t-set="label">Quick actions</t>
</t> </t>
</button> </button>
@ -46,28 +46,28 @@
<!-- Add responsive icons to buttons --> <!-- Add responsive icons to buttons -->
<t t-jquery=".o_form_button_edit" t-operation="inner"> <t t-jquery=".o_form_button_edit" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'pencil'"/> <t t-set="icon" t-value="'pencil'" />
<t t-set="label">Edit</t> <t t-set="label">Edit</t>
</t> </t>
</t> </t>
<t t-jquery=".o_form_button_create" t-operation="inner"> <t t-jquery=".o_form_button_create" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'plus'"/> <t t-set="icon" t-value="'plus'" />
<t t-set="label">Create</t> <t t-set="label">Create</t>
</t> </t>
</t> </t>
<t t-jquery=".o_form_button_save" t-operation="inner"> <t t-jquery=".o_form_button_save" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'check'"/> <t t-set="icon" t-value="'check'" />
<t t-set="label">Save</t> <t t-set="label">Save</t>
</t> </t>
</t> </t>
<t t-jquery=".o_form_button_cancel" t-operation="inner"> <t t-jquery=".o_form_button_cancel" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'times'"/> <t t-set="icon" t-value="'times'" />
<t t-set="label">Discard</t> <t t-set="label">Discard</t>
</t> </t>
</t> </t>
@ -77,8 +77,8 @@
<!-- Add responsive icons to buttons --> <!-- Add responsive icons to buttons -->
<t t-jquery="button" t-operation="inner"> <t t-jquery="button" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'plus'"/> <t t-set="icon" t-value="'plus'" />
<t t-set="label" t-value="create_text || _t('Create')"/> <t t-set="label" t-value="create_text || _t('Create')" />
</t> </t>
</t> </t>
</t> </t>
@ -92,21 +92,21 @@
<!-- Add responsive icons to buttons --> <!-- Add responsive icons to buttons -->
<t t-jquery=".o_list_button_add" t-operation="inner"> <t t-jquery=".o_list_button_add" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'plus'"/> <t t-set="icon" t-value="'plus'" />
<t t-set="label">Create</t> <t t-set="label">Create</t>
</t> </t>
</t> </t>
<t t-jquery=".o_list_button_save" t-operation="inner"> <t t-jquery=".o_list_button_save" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'check'"/> <t t-set="icon" t-value="'check'" />
<t t-set="label">Save</t> <t t-set="label">Save</t>
</t> </t>
</t> </t>
<t t-jquery=".o_list_button_discard" t-operation="inner"> <t t-jquery=".o_list_button_discard" t-operation="inner">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'times'"/> <t t-set="icon" t-value="'times'" />
<t t-set="label">Discard</t> <t t-set="label">Discard</t>
</t> </t>
</t> </t>
@ -114,26 +114,28 @@
<t t-extend="Sidebar"> <t t-extend="Sidebar">
<!-- Replace some common sections by icons in mobile --> <!-- Replace some common sections by icons in mobile -->
<t t-jquery=".o_dropdown_toggler_btn t[t-esc='section.label']" <t
t-operation="replace"> t-jquery=".o_dropdown_toggler_btn t[t-esc='section.label']"
<t t-set="label" t-value="section.label"/> t-operation="replace"
>
<t t-set="label" t-value="section.label" />
<t t-if="section.name == 'files'"> <t t-if="section.name == 'files'">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'paperclip'"/> <t t-set="icon" t-value="'paperclip'" />
</t> </t>
</t> </t>
<t t-elif="section.name == 'print'"> <t t-elif="section.name == 'print'">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'print'"/> <t t-set="icon" t-value="'print'" />
</t> </t>
</t> </t>
<t t-elif="section.name == 'other'"> <t t-elif="section.name == 'other'">
<t t-call="web_responsive.icon_button"> <t t-call="web_responsive.icon_button">
<t t-set="icon" t-value="'wrench'"/> <t t-set="icon" t-value="'wrench'" />
</t> </t>
</t> </t>
<t t-else=""> <t t-else="">
<span t-esc="label"/> <span t-esc="label" />
</t> </t>
</t> </t>
</t> </t>
@ -142,7 +144,7 @@
<t t-jquery=".o_chatter_topbar" t-operation="replace"> <t t-jquery=".o_chatter_topbar" t-operation="replace">
<div class="o_chatter_header_container"> <div class="o_chatter_header_container">
<div class="o_chatter_topbar"> <div class="o_chatter_topbar">
<div class="o_topbar_right_area"/> <div class="o_topbar_right_area" />
</div> </div>
</div> </div>
</t> </t>

View File

@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- Copyright 2017-2018 Tecnativa - Jairo Llopis <!-- Copyright 2017-2018 Tecnativa - Jairo Llopis
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -->
<template> <template>
<t t-extend="Menu"> <t t-extend="Menu">
<t t-jquery=".o_menu_apps" t-operation="after"> <t t-jquery=".o_menu_apps" t-operation="after">
<!-- Hamburger button to show submenus in sm screens --> <!-- Hamburger button to show submenus in sm screens -->
<button class="o-menu-toggle d-md-none" <button
data-toggle="collapse" class="o-menu-toggle d-md-none"
data-target=".o_main_navbar .o_menu_sections"> data-toggle="collapse"
<i class="fa fa-bars"/> data-target=".o_main_navbar .o_menu_sections"
>
<i class="fa fa-bars" />
</button> </button>
</t> </t>
</t> </t>

View File

@ -1,20 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<!-- <!--
Copyright 2016 LasLabs Inc. Copyright 2016 LasLabs Inc.
@author Dave Lasley <dave@laslabs.com> @author Dave Lasley <dave@laslabs.com>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
--> -->
<odoo> <odoo>
<template id="assets_backend" name="Open Mobile Assets" inherit_id="web.assets_backend"> <template
id="assets_backend"
name="Open Mobile Assets"
inherit_id="web.assets_backend"
>
<xpath expr="."> <xpath expr=".">
<link rel="stylesheet" <link
href="/web_responsive/static/src/css/web_responsive.scss" rel="stylesheet"
/> href="/web_responsive/static/src/css/web_responsive.scss"
<script type="application/javascript" />
src="/web_responsive/static/src/js/web_responsive.js" <script
/> type="application/javascript"
src="/web_responsive/static/src/js/web_responsive.js"
/>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>

View File

@ -1,11 +1,9 @@
<?xml version="1.0"?> <?xml version="1.0" ?>
<!-- <!--
Copyright 2018 Copyright 2018
@author Alexanre Díaz <dev@redneboa.es> @author Alexanre Díaz <dev@redneboa.es>
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
--> -->
<odoo> <odoo>
<record id="view_users_form_simple_modif" model="ir.ui.view"> <record id="view_users_form_simple_modif" model="ir.ui.view">

View File

@ -1,18 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<!-- <!--
Copyright 2018 Alexandre Díaz Copyright 2018 Alexandre Díaz
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
--> -->
<odoo> <odoo>
<template id="webclient_bootstrap" <template
inherit_id="web.webclient_bootstrap" id="webclient_bootstrap"
name="App Drawer - Web Client" inherit_id="web.webclient_bootstrap"
> name="App Drawer - Web Client"
>
<xpath expr="//t[@t-set='body_classname']" position="attributes"> <xpath expr="//t[@t-set='body_classname']" position="attributes">
<attribute name="t-value" add="+ ' o_chatter_position_' + (request.env.user.chatter_position or 'normal')" separator=" " /> <attribute
name="t-value"
add="+ ' o_chatter_position_' + (request.env.user.chatter_position or 'normal')"
separator=" "
/>
</xpath> </xpath>
</template> </template>