[FIX] web, mail, base: config's isMobile definition

The `isMobile` variable was defined at the right place (`config.device`)
but was set at the wrong place (`config`).

Thank you for making me author of all the `isMobile` lines by
the way... :)
This commit is contained in:
qsm-odoo
2017-09-29 14:41:41 +02:00
parent 34a7d9a1fb
commit 87f1e360a8
12 changed files with 21 additions and 21 deletions
+3 -3
View File
@@ -100,7 +100,7 @@ function add_message (data, options) {
update_channel_unread_counter(channel, channel.unread_counter+1);
}
if (channel.is_chat && options.show_notification) {
if (!client_action_open && !config.isMobile) {
if (!client_action_open && !config.device.isMobile) {
// automatically open chat window
chat_manager.bus.trigger('open_chat', channel, { passively: true });
}
@@ -646,7 +646,7 @@ var ChatManager = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
start: function () {
this.is_ready = session.is_bound.then(function(){
var context = _.extend({isMobile: config.isMobile}, session.user_context);
var context = _.extend({isMobile: config.device.isMobile}, session.user_context);
return session.rpc('/mail/client_action', {context: context});
}).then(this._onMailClientAction.bind(this));
@@ -1032,7 +1032,7 @@ var ChatManager = Class.extend(Mixins.EventDispatcherMixin, ServicesMixin, {
create_channel: function (name, type) {
var method = type === "dm" ? "channel_get" : "channel_create";
var args = type === "dm" ? [[name]] : [name, type];
var context = _.extend({isMobile: config.isMobile}, session.user_context);
var context = _.extend({isMobile: config.device.isMobile}, session.user_context);
return this._rpc({
model: 'mail.channel',
method: method,
+2 -2
View File
@@ -43,7 +43,7 @@ return Widget.extend({
this.status = this.options.status;
this.unread_msgs = unread_msgs || 0;
this.is_hidden = false;
this.isMobile = config.isMobile;
this.isMobile = config.device.isMobile;
},
start: function () {
this.$input = this.$('.o_composer_text_field');
@@ -63,7 +63,7 @@ return Widget.extend({
} else if (this.options.autofocus) {
this.focus_input();
}
if (!config.isMobile) {
if (!config.device.isMobile) {
this.$el.css('margin-right', $.position.scrollbarWidth());
}
var def = this.thread.replace(this.$('.o_chat_content'));
@@ -10,7 +10,7 @@ var session = require('web.session');
var QWeb = core.qweb;
if (!config.isMobile) {
if (!config.device.isMobile) {
return;
}
+1 -1
View File
@@ -379,7 +379,7 @@ var BasicComposer = Widget.extend(chat_mixin, {
send_text: _t('Send'),
default_body: '',
default_mention_selections: {},
isMobile: config.isMobile
isMobile: config.device.isMobile
});
this.context = this.options.context;
+1 -1
View File
@@ -30,7 +30,7 @@ var MessagingMenu = Widget.extend({
},
init: function () {
this._super.apply(this, arguments);
this.isMobile = config.isMobile; // used by the template
this.isMobile = config.device.isMobile; // used by the template
},
start: function () {
this.$filter_buttons = this.$('.o_filter_button');
+1 -1
View File
@@ -272,7 +272,7 @@ function render_hidden_sessions_dropdown () {
sessions: display_state.hidden_sessions,
open: display_state.windows_dropdown_is_open,
unread_counter: display_state.hidden_unread_counter,
widget: {isMobile: config.isMobile},
widget: {isMobile: config.device.isMobile},
}));
return $dropdown;
}
+1 -1
View File
@@ -78,7 +78,7 @@ function _updateSizeProps() {
var sc = _getSizeClass();
if (sc !== config.device.size_class) {
config.device.size_class = sc;
config.isMobile = config.device.size_class <= config.device.SIZES.XS;
config.device.isMobile = config.device.size_class <= config.device.SIZES.XS;
core.bus.trigger('size_class', sc);
}
}
@@ -99,7 +99,7 @@ var KanbanColumn = Widget.extend({
}
this.$header.find('.o_kanban_header_title').tooltip();
if (!config.isMobile && this.draggable !== false) {
if (!config.device.isMobile && this.draggable !== false) {
// deactivate sortable in mobile mode. It does not work anyway,
// and it breaks horizontal scrolling in kanban views. Someday, we
// should find a way to use the touch events to make sortable work.
@@ -239,7 +239,7 @@ var KanbanColumn = Widget.extend({
this.$header.find('.o_column_title').text(title);
this.$header.find('.o-kanban-count').text(this.records.length);
this.$el.toggleClass('o_column_folded', this.folded && !config.isMobile);
this.$el.toggleClass('o_column_folded', this.folded && !config.device.isMobile);
var tooltip = this.size + _t(' records');
tooltip = '<p>' + tooltip + '</p>' + this.tooltipInfo;
this.$header.find('.o_kanban_header_title').tooltip({html: true}).attr('data-original-title', tooltip);
@@ -14,7 +14,7 @@ var KanbanRenderer = require('web.KanbanRenderer');
var qweb = core.qweb;
if (!config.isMobile) {
if (!config.device.isMobile) {
return;
}
@@ -35,7 +35,7 @@ var KanbanView = BasicView.extend({
this.loadParams.limit = this.loadParams.limit || 40;
// in mobile, columns are lazy-loaded, so set 'openGroupByDefault' to
// false so that they will won't be loaded by the initial load
this.loadParams.openGroupByDefault = config.isMobile ? false : true;
this.loadParams.openGroupByDefault = config.device.isMobile ? false : true;
this.loadParams.type = 'list';
this.loadParams.groupBy = arch.attrs.default_group_by ? [arch.attrs.default_group_by] : (params.groupBy || []);
var progressBar;
@@ -62,7 +62,7 @@ var KanbanView = BasicView.extend({
this.rendererParams.column_options = {
editable: activeActions.group_edit,
deletable: activeActions.group_delete,
group_creatable: activeActions.group_create && !config.isMobile,
group_creatable: activeActions.group_create && !config.device.isMobile,
quick_create: params.isQuickCreateEnabled || this._isQuickCreateEnabled(viewInfo),
hasProgressBar: !!progressBar,
};
@@ -77,7 +77,7 @@ var KanbanView = BasicView.extend({
this.controllerParams.readOnlyMode = false;
this.controllerParams.hasButtons = true;
if (config.isMobile) {
if (config.device.isMobile) {
this.jsLibs.push('/web/static/lib/jquery.touchSwipe/jquery.touchSwipe.js');
}
},
@@ -12,7 +12,7 @@ var _t = core._t;
var SwitchCompanyMenu = Widget.extend({
template: 'SwitchCompanyMenu',
willStart: function() {
this.isMobile = config.isMobile;
this.isMobile = config.device.isMobile;
if (!session.user_companies) {
return $.Deferred().reject();
}
@@ -24,7 +24,7 @@ var BaseSettingRenderer = FormRenderer.extend({
start: function () {
this._super.apply(this, arguments);
if (config.isMobile) {
if (config.device.isMobile) {
core.bus.on("DOM_updated", this, function () {
this._moveToTab(this.currentIndex || this._currentAppIndex());
});
@@ -196,7 +196,7 @@ var BaseSettingRenderer = FormRenderer.extend({
this.activeView = view;
this.activeTab = tab;
if (config.isMobile) {
if (config.device.isMobile) {
this._activateSettingMobileTab(this.currentIndex);
} else {
tab.addClass("selected");
@@ -219,7 +219,7 @@ var BaseSettingRenderer = FormRenderer.extend({
_onKeyUpSearch: function (event) {
this.searchText = this.searchInput.val();
this.activeTab.removeClass('selected');
if (config.isMobile) {
if (config.device.isMobile) {
this.$('.settings_tab').addClass('o_hidden');
this.$('.settings').addClass('d-block');
}
@@ -241,7 +241,7 @@ var BaseSettingRenderer = FormRenderer.extend({
});
this.activeTab.removeClass('o_hidden').addClass('selected');
this.activeView.removeClass('o_hidden');
if (config.isMobile) {
if (config.device.isMobile) {
this.$('.settings_tab').removeClass('o_hidden');
this.$('.settings').removeClass('d-block');
}