[IMP] base, web: add type=fullscreen to ir_actions
With this commit, actions can have a type=fullscreen. This means that the navbar will be hidden, for the action and for all subsequent actions open in the breadcrumb There is no real security behind this, this is just a feature for convenience, so users can bookmark an url an open some action in a way that they are not distracted by anything. In short, this is some kind of light 'kiosk' mode.
This commit is contained in:
@@ -27,6 +27,9 @@ var WebClient = Widget.extend({
|
||||
clear_uncommitted_changes: function (e) {
|
||||
this.clear_uncommitted_changes().then(e.data.callback);
|
||||
},
|
||||
toggle_fullscreen: function (event) {
|
||||
this.toggle_fullscreen(event.data.fullscreen);
|
||||
},
|
||||
},
|
||||
init: function(parent, client_options) {
|
||||
this.client_options = {};
|
||||
@@ -103,9 +106,6 @@ var WebClient = Widget.extend({
|
||||
self.$('.oe_dropdown_menu.oe_opened, .oe_dropdown_toggle.oe_opened').removeClass('oe_opened');
|
||||
}
|
||||
});
|
||||
core.bus.on('set_full_screen', this, function (full_screen) {
|
||||
this.set_content_full_screen(full_screen);
|
||||
});
|
||||
core.bus.on('connection_lost', this, this.on_connection_lost);
|
||||
core.bus.on('connection_restored', this, this.on_connection_restored);
|
||||
|
||||
@@ -233,10 +233,8 @@ var WebClient = Widget.extend({
|
||||
//--------------------------------------------------------------
|
||||
// Misc.
|
||||
//--------------------------------------------------------------
|
||||
set_content_full_screen: function(fullscreen) {
|
||||
$(document.body).css('overflow-y', fullscreen ? 'hidden' : 'scroll');
|
||||
this.$('.oe_webclient').toggleClass(
|
||||
'oe_content_full_screen', fullscreen);
|
||||
toggle_fullscreen: function(fullscreen) {
|
||||
this.$el.toggleClass('o_fullscreen', fullscreen);
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -320,6 +320,7 @@ var ActionManager = Widget.extend({
|
||||
if (options.clear_breadcrumbs) {
|
||||
self.clear_action_stack(old_action_stack);
|
||||
}
|
||||
self.toggle_fullscreen();
|
||||
}).fail(function () {
|
||||
// Destroy failed action and restore internal state
|
||||
new_action.destroy();
|
||||
@@ -416,6 +417,13 @@ var ActionManager = Widget.extend({
|
||||
this.inner_action = null;
|
||||
this.inner_widget = null;
|
||||
}
|
||||
this.toggle_fullscreen();
|
||||
},
|
||||
toggle_fullscreen: function() {
|
||||
var is_fullscreen = _.some(this.action_stack, function(action) {
|
||||
return action.action_descr.target === "fullscreen";
|
||||
});
|
||||
this.trigger_up("toggle_fullscreen", {fullscreen: is_fullscreen});
|
||||
},
|
||||
do_push_state: function(state) {
|
||||
if (!this.webclient || this.dialog) {
|
||||
|
||||
@@ -161,6 +161,12 @@ return AbstractWebClient.extend({
|
||||
});
|
||||
});
|
||||
},
|
||||
toggle_fullscreen: function(fullscreen) {
|
||||
this._super(fullscreen);
|
||||
if (!fullscreen) {
|
||||
this.menu.reflow();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -5,6 +5,16 @@
|
||||
.o-flex-flow(column, nowrap);
|
||||
overflow: hidden;
|
||||
|
||||
&.o_fullscreen {
|
||||
#oe_main_menu_navbar {
|
||||
display: none;
|
||||
}
|
||||
.o_main .o_sub_menu {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.navbar {
|
||||
.o-flex(0, 0, auto);
|
||||
|
||||
|
||||
@@ -63,8 +63,9 @@ Its fields are:
|
||||
search view to load for the action. Defaults to fetching the default
|
||||
search view for the model
|
||||
``target`` (optional)
|
||||
whether the views should be open in the main content area (``current``)
|
||||
or in a dialog/popup (``new``). Defaults to ``current``.
|
||||
whether the views should be open in the main content area (``current``),
|
||||
in full screen mode (``fullscreen``) or in a dialog/popup (``new``). Defaults
|
||||
to ``current``.
|
||||
``context`` (optional)
|
||||
additional context data to pass to the views
|
||||
``domain`` (optional)
|
||||
|
||||
@@ -289,7 +289,7 @@ class IrActionsActWindow(models.Model):
|
||||
help="Model name of the object to open in the view window")
|
||||
src_model = fields.Char(string='Source Model',
|
||||
help="Optional model name of the objects on which this action should be visible")
|
||||
target = fields.Selection([('current', 'Current Window'), ('new', 'New Window'), ('inline', 'Inline Edit'), ('inlineview', 'Inline View')], default="current", string='Target Window')
|
||||
target = fields.Selection([('current', 'Current Window'), ('new', 'New Window'), ('inline', 'Inline Edit'), ('inlineview', 'Inline View'), ('fullscreen', 'Full Screen')], default="current", string='Target Window')
|
||||
view_mode = fields.Char(required=True, default='tree,form',
|
||||
help="Comma-separated list of allowed view modes, such as 'form', 'tree', 'calendar', etc. (Default: tree,form)")
|
||||
view_type = fields.Selection([('tree', 'Tree'), ('form', 'Form')], default="form", string='View Type', required=True,
|
||||
|
||||
Reference in New Issue
Block a user