summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js2
-rw-r--r--addons/web/static/src/js/services/config.js13
-rw-r--r--addons/web/static/src/js/views/basic/basic_view.js2
-rw-r--r--addons/web/static/src/js/views/form/form_renderer.js2
-rw-r--r--addons/web/static/src/js/views/graph/graph_renderer.js2
5 files changed, 11 insertions, 10 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 94facd80ceb..c9375c2d4b9 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -1037,7 +1037,7 @@ var FieldPhone = FieldEmail.extend({
* @private
*/
_canCall: function () {
- return config.device.size_class <= config.device.SIZES.XS;
+ return config.device.isMobile;
}
});
diff --git a/addons/web/static/src/js/services/config.js b/addons/web/static/src/js/services/config.js
index 8a42e755322..cb32ed583d4 100644
--- a/addons/web/static/src/js/services/config.js
+++ b/addons/web/static/src/js/services/config.js
@@ -1,4 +1,4 @@
-odoo.define('web.config', function (require) {
+odoo.define('web.config', function () {
"use strict";
/**
@@ -31,7 +31,7 @@ var config = {
*/
touch: 'ontouchstart' in window || 'onmsgesturechange' in window,
/**
- * size_class is an integer: 0, 1, 2 or 3, depending on the (current)
+ * size_class is an integer: 0, 1, 2, 3 or 4, depending on the (current)
* size of the device. This is a dynamic property, updated whenever the
* browser is resized
*
@@ -41,21 +41,22 @@ var config = {
/**
* A frequent use case is to have a different render in 'mobile' mode,
* meaning when the screen is small. This flag (boolean) is true when
- * the size is not 3. It is also updated dynamically.
+ * the size is XXS or XS. It is also updated dynamically.
*
* @type Boolean
*/
isMobile: null,
/**
- * Mapping between the numbers 0,1,2,3 and some descriptions
+ * Mapping between the numbers 0,1,2,3,4 and some descriptions
*/
- SIZES: { XS: 0, SM: 1, MD: 2, LG: 3 },
+ SIZES: { XXS: 0, XS: 1, SM: 2, MD: 3, LG: 4 },
},
};
var medias = [
- window.matchMedia('(max-width: 767px)'),
+ window.matchMedia('(max-width: 474px)'),
+ window.matchMedia('(min-width: 475px) and (max-width: 767px)'),
window.matchMedia('(min-width: 768px) and (max-width: 991px)'),
window.matchMedia('(min-width: 992px) and (max-width: 1199px)'),
window.matchMedia('(min-width: 1200px)')
diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/js/views/basic/basic_view.js
index f428a83cd41..df9f9807bfd 100644
--- a/addons/web/static/src/js/views/basic/basic_view.js
+++ b/addons/web/static/src/js/views/basic/basic_view.js
@@ -246,7 +246,7 @@ var BasicView = AbstractView.extend({
}
}
if (mode.indexOf(',') !== -1) {
- mode = config.device.size_class !== config.device.SIZES.XS ? 'tree' : 'kanban';
+ mode = config.device.isMobile ? 'kanban' : 'tree';
}
if (mode === 'tree') {
mode = 'list';
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js
index 779121de3e9..7d9c3cd2d78 100644
--- a/addons/web/static/src/js/views/form/form_renderer.js
+++ b/addons/web/static/src/js/views/form/form_renderer.js
@@ -279,7 +279,7 @@ var FormRenderer = BasicRenderer.extend({
var visible_buttons = buttons_partition[1];
// Get the unfolded buttons according to window size
- var nb_buttons = [2, 4, 6, 7][config.device.size_class];
+ var nb_buttons = [2, 2, 4, 6, 7][config.device.size_class];
var unfolded_buttons = visible_buttons.slice(0, nb_buttons).concat(invisible_buttons);
// Get the folded buttons
diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js
index 4d51f8786d0..07155e327e3 100644
--- a/addons/web/static/src/js/views/graph/graph_renderer.js
+++ b/addons/web/static/src/js/views/graph/graph_renderer.js
@@ -20,7 +20,7 @@ var qweb = core.qweb;
var CHART_TYPES = ['pie', 'bar', 'line'];
// hide top legend when too many items for device size
-var MAX_LEGEND_LENGTH = 25 * (1 + config.device.size_class);
+var MAX_LEGEND_LENGTH = 25 * (Math.max(1, config.device.size_class));
return AbstractRenderer.extend({
className: "o_graph_svg_container",