mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
* Fixes issue #987 * Follow new readme structure * Use Less * Hide expand/collapse buttons if select a view type that isn't a 'list'
This commit is contained in:
7
web_group_expand/readme/CONTRIBUTORS.rst
Normal file
7
web_group_expand/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
* Mantavya Gajjar <mga@openerp.com>
|
||||||
|
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
|
||||||
|
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||||
|
* Jay Vora (SerpentCS) for their alternative implementation
|
||||||
|
* Aldo Soares <soares_aldo@hotmail.com>
|
||||||
|
* Meet Dholakia <meetcomputer009@gmail.com>
|
||||||
|
* Alexandre Díaz <dev@redneboa.es>
|
||||||
4
web_group_expand/readme/DESCRIPTION.rst
Normal file
4
web_group_expand/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
A group by list can be expanded and collapased with buttons
|
||||||
|
|
||||||
|
You'll see two buttons appear on top right corner of the list when you perform
|
||||||
|
a group by with which you can expand and collapse grouped records by level.
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
.o_favorites_menu + .toggle_buttons{
|
|
||||||
float: left;
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.o_favorites_menu + .toggle_buttons button{
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
@@ -23,21 +23,28 @@ odoo.define('web_group_expand.web_group_expand', function (require) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
ViewManager.include({
|
ViewManager.include({
|
||||||
|
init: function(parent, dataset, views, flags, options) {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
this._has_groupby_search = false;
|
||||||
|
},
|
||||||
_process_search_data: function () {
|
_process_search_data: function () {
|
||||||
var res = this._super.apply(this, arguments);
|
var res = this._super.apply(this, arguments);
|
||||||
if (this.active_view && this.active_view.type == 'list' && this.searchview) {
|
this._has_groupby_search = (res.groupBy.length > 0);
|
||||||
if(this.searchview.groupby_expand_menu){
|
this._set_groupby_expand_menu_visible(this._has_groupby_search && this.active_view && this.active_view.type === 'list');
|
||||||
var has_groups = res.groupBy.length > 0
|
|
||||||
this.searchview.groupby_expand_menu.do_toggle_visibility(has_groups)
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
this.searchview.groupby_expand_menu.do_toggle_visibility(false)
|
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
switch_mode: function(view_type, view_options) {
|
||||||
|
return this._super.apply(this, arguments).then(function() {
|
||||||
|
this._set_groupby_expand_menu_visible(this._has_groupby_search && view_type === 'list');
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
|
_set_groupby_expand_menu_visible: function(is_visible) {
|
||||||
|
if (this.searchview && this.searchview.groupby_expand_menu) {
|
||||||
|
this.searchview.groupby_expand_menu.do_toggle_visibility(is_visible);
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
10
web_group_expand/static/src/less/web_group_expand.less
Normal file
10
web_group_expand/static/src/less/web_group_expand.less
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.o_favorites_menu {
|
||||||
|
+.toggle_buttons {
|
||||||
|
float: left;
|
||||||
|
padding-left: 5px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<odoo>
|
<odoo>
|
||||||
<template id="assets_backend" name="web_groupby_expand assets" inherit_id="web.assets_backend">
|
<template id="assets_backend" name="web_groupby_expand assets" inherit_id="web.assets_backend">
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<link rel="stylesheet" href="/web_group_expand/static/src/css/web_group_expand.css"/>
|
<link rel="stylesheet" href="/web_group_expand/static/src/less/web_group_expand.less"/>
|
||||||
<script type="text/javascript" src="/web_group_expand/static/src/js/web_group_expand.js"></script>
|
<script type="text/javascript" src="/web_group_expand/static/src/js/web_group_expand.js"></script>
|
||||||
<script type="text/javascript" src="/web_group_expand/static/src/js/web_group_expand_menu.js"></script>
|
<script type="text/javascript" src="/web_group_expand/static/src/js/web_group_expand_menu.js"></script>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
Reference in New Issue
Block a user