Browse Source

Merge pull request #730 from Tecnativa/10.0-PR-web_responsive-kanban-view

[IMP] web_responsive: Load default kanban view for small screen
pull/731/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
c6813df939
  1. 3
      web_responsive/README.rst
  2. 18
      web_responsive/static/src/js/web_responsive.js

3
web_responsive/README.rst

@ -12,6 +12,7 @@ Features:
* New navigation with an App drawer * New navigation with an App drawer
* Keyboard shortcuts for easier navigation * Keyboard shortcuts for easier navigation
* Display kanban views for small screens if an action or field One2x
Installation Installation
@ -53,6 +54,7 @@ this module.
great styles, but also `JavaScript that causes issues on mobile great styles, but also `JavaScript that causes issues on mobile
<https://github.com/OCA/web/pull/446#issuecomment-254827880>`_ <https://github.com/OCA/web/pull/446#issuecomment-254827880>`_
Bug Tracker Bug Tracker
=========== ===========
@ -76,6 +78,7 @@ Contributors
* Dave Lasley <dave@laslabs.com> * Dave Lasley <dave@laslabs.com>
* Jairo Llopis <jairo.llopis@tecnativa.com> * Jairo Llopis <jairo.llopis@tecnativa.com>
* Dennis Sluijk <d.sluijk@onestein.nl> * Dennis Sluijk <d.sluijk@onestein.nl>
* Sergio Teruel <sergio.teruel@tecnativa.com>
Maintainer Maintainer
---------- ----------

18
web_responsive/static/src/js/web_responsive.js

@ -8,6 +8,9 @@ odoo.define('web_responsive', function(require) {
var Class = require('web.Class'); var Class = require('web.Class');
var SearchView = require('web.SearchView'); var SearchView = require('web.SearchView');
var core = require('web.core'); var core = require('web.core');
var config = require('web.config');
var FieldOne2Many = core.form_widget_registry.get('one2many');
var ViewManager = require('web.ViewManager');
Menu.include({ Menu.include({
@ -286,10 +289,25 @@ odoo.define('web_responsive', function(require) {
new AppDrawer(); new AppDrawer();
}); });
// if we are in small screen change default view to kanban if exists
ViewManager.include({
get_default_view: function() {
var default_view = this._super()
if (config.device.size_class <= config.device.SIZES.XS &&
default_view.type != 'kanban' &&
this.views['kanban'])
{
default_view.type = 'kanban';
};
return default_view;
},
});
return { return {
'AppDrawer': AppDrawer, 'AppDrawer': AppDrawer,
'SearchView': SearchView, 'SearchView': SearchView,
'Menu': Menu, 'Menu': Menu,
'ViewManager': ViewManager,
}; };
}); });
Loading…
Cancel
Save