[REF] web: action manager: wrap the client actions in a div
this way we can style the div and use the trick to have the child of a flex-item filling 100% of its parent (flex item in relative position and flex child in an absolute position). It is needed to have a consistent look betwenn Odoo enterprise and Odoo community.
This commit is contained in:
committed by
Aaron Bohy
parent
c8b1f0d678
commit
4e24b81616
@@ -919,6 +919,10 @@
|
||||
.openerp .oe_application .oe_application {
|
||||
width: 100%;
|
||||
}
|
||||
.openerp .oe_application .oe_client_action {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.openerp .oe-view-manager {
|
||||
-webkit-box-flex: 1;
|
||||
-webkit-flex: 1 1 auto;
|
||||
|
||||
@@ -808,6 +808,10 @@ $sheet-padding: 16px
|
||||
flex-direction: column
|
||||
.oe_application
|
||||
width: 100%
|
||||
|
||||
.oe_client_action
|
||||
height: 100%
|
||||
position: relative
|
||||
// }}}
|
||||
// ViewManager common {{{
|
||||
.oe-view-manager
|
||||
|
||||
@@ -21,6 +21,13 @@ var Action = core.Class.extend({
|
||||
this.action_descr = action;
|
||||
this.title = action.display_name || action.name;
|
||||
},
|
||||
/**
|
||||
* Not implemented for client actions
|
||||
* @return {Deferred} a rejected Deferred
|
||||
*/
|
||||
appendTo: function() {
|
||||
return $.Deferred().reject();
|
||||
},
|
||||
/**
|
||||
* This method should restore this previously loaded action
|
||||
* Calls on_reverse_breadcrumb callback if defined
|
||||
@@ -96,6 +103,17 @@ var WidgetAction = Action.extend({
|
||||
this.widget.set('title', this.title);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Wraps the action's widget in a container and appends it to el
|
||||
* @param {DocumentFragment} [el] where to append the widget
|
||||
* @return {Deferred} resolved when the widget is appended
|
||||
*/
|
||||
appendTo: function(el) {
|
||||
this.client_action_container = document.createElement('div');
|
||||
this.client_action_container.className = 'oe_client_action';
|
||||
el.appendChild(this.client_action_container);
|
||||
return this.widget.appendTo(this.client_action_container);
|
||||
},
|
||||
/**
|
||||
* Restores WidgetAction by calling do_show on its widget
|
||||
*/
|
||||
@@ -106,14 +124,23 @@ var WidgetAction = Action.extend({
|
||||
/**
|
||||
* Destroys the widget
|
||||
*/
|
||||
destroy: function() {
|
||||
destroy: function() {
|
||||
this.widget.destroy();
|
||||
this.client_action_container.remove();
|
||||
},
|
||||
});
|
||||
/**
|
||||
* Specialization of WidgetAction for window actions (i.e. ViewManagers)
|
||||
*/
|
||||
var ViewManagerAction = WidgetAction.extend({
|
||||
/**
|
||||
* Appends the action's widget to el
|
||||
* @param {DocumentFragment} [el] where to append the widget
|
||||
* @return {Deferred} resolved when the widget is appended
|
||||
*/
|
||||
appendTo: function(el) {
|
||||
return this.widget.appendTo(el);
|
||||
},
|
||||
/**
|
||||
* Restores a ViewManagerAction
|
||||
* Switches to the requested view by calling select_view on the ViewManager
|
||||
@@ -133,6 +160,12 @@ var ViewManagerAction = WidgetAction.extend({
|
||||
set_is_in_DOM: function(is_in_DOM) {
|
||||
this.widget.is_in_DOM = is_in_DOM;
|
||||
},
|
||||
/**
|
||||
* Destroys the widget
|
||||
*/
|
||||
destroy: function() {
|
||||
this.widget.destroy();
|
||||
},
|
||||
/**
|
||||
* @return {Array} array of Objects that will be interpreted to display the breadcrumbs
|
||||
*/
|
||||
@@ -239,7 +272,7 @@ var ActionManager = Widget.extend({
|
||||
// render the inner_widget in a fragment, and append it to the
|
||||
// document only when it's ready
|
||||
var new_widget_fragment = document.createDocumentFragment();
|
||||
return $.when(this.inner_widget.appendTo(new_widget_fragment)).done(function() {
|
||||
return $.when(this.inner_action.appendTo(new_widget_fragment)).done(function() {
|
||||
// Detach the fragment of the previous action and store it within the action
|
||||
if (old_action) {
|
||||
old_action.set_fragment(old_widget.$el.detach());
|
||||
|
||||
Reference in New Issue
Block a user