mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] New module <web_group_expand>
This commit is contained in:
committed by
BT-aestebanez
parent
cf0fd15ebd
commit
739e83c55e
18
web_group_expand/static/src/css/expand_buttons.css
Normal file
18
web_group_expand/static/src/css/expand_buttons.css
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
.openerp ul#oe_group_by li.oe_group_expand{
|
||||
border: none;
|
||||
border-top: 1px solid #ababab;
|
||||
position:relative;
|
||||
font-size:13px;
|
||||
transform: rotate(90deg);
|
||||
-webkit-transform: rotate(90deg);
|
||||
}
|
||||
.openerp hr.oe_expand_button_hr{
|
||||
height:2px;
|
||||
visibility:hidden;
|
||||
margin-bottom:-7px;
|
||||
}
|
||||
.openerp #oe_group_by_reset {
|
||||
top:3px;
|
||||
position:relative;
|
||||
}
|
||||
43
web_group_expand/static/src/js/web_group_expand.js
Normal file
43
web_group_expand/static/src/js/web_group_expand.js
Normal file
@@ -0,0 +1,43 @@
|
||||
openerp.web_group_expand = function(openerp) {
|
||||
var QWeb = openerp.web.qweb;
|
||||
openerp.web.ViewManager.include({
|
||||
switch_mode: function(view_type, no_store, view_options) {
|
||||
if (view_type != 'list' && view_type != 'tree' ) {
|
||||
this.$el.find("ul#oe_group_by").remove();
|
||||
}
|
||||
if(view_type == 'tree'){
|
||||
this.load_expand_buttons();
|
||||
this.$ExpandButtons.find("a#oe_group_by_reset").click(function(){
|
||||
$('.oe_open .treeview-tr.oe-treeview-first').filter(function(){return ($(this).parents('tr').attr('data-level') == 1)}).click()
|
||||
});
|
||||
this.$ExpandButtons.find("a#oe_group_by_expand").click(function(){
|
||||
$('.treeview-tr.oe-treeview-first').filter(function(){return (!$(this).parents().is('.oe_open')) & ($(this).parents().css( "display" ) != 'none')}).click();
|
||||
});
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
expand: function(domains, contexts, groupbys) {
|
||||
this.$el.find("ul#oe_group_by").remove();
|
||||
if(groupbys.length && this.active_view == 'list') {
|
||||
this.load_expand_buttons();
|
||||
this.$el.find("a#oe_group_by_reset").click(function(){
|
||||
$('span.ui-icon-triangle-1-s').click()
|
||||
});
|
||||
this.$el.find("a#oe_group_by_expand").click(function(){
|
||||
$('span.ui-icon-triangle-1-e').click()
|
||||
});
|
||||
}
|
||||
},
|
||||
load_expand_buttons:function() {
|
||||
var self = this;
|
||||
this.$ExpandButtons = $(QWeb.render("GroupExpand.Buttons", {'widget':self}));
|
||||
this.$el.find("ul.oe_view_manager_switch.oe_button_group.oe_right").before(this.$ExpandButtons);
|
||||
},
|
||||
setup_search_view: function(view_id, search_defaults) {
|
||||
self = this;
|
||||
res = this._super.apply(this, arguments);
|
||||
this.searchview.on('search_data', self, this.expand);
|
||||
return res
|
||||
},
|
||||
})
|
||||
}
|
||||
8
web_group_expand/static/src/xml/expand_buttons.xml
Normal file
8
web_group_expand/static/src/xml/expand_buttons.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- vim:fdl=1:
|
||||
-->
|
||||
<templates id="template" xml:space="preserve">
|
||||
<t t-name="GroupExpand.Buttons">
|
||||
<div class="oe_list_buttons"><ul id="oe_group_by" class="oe_view_manager_switch oe_button_group oe_right"><li class="oe_i oe_group_expand"><a id="oe_group_by_expand"><hr class="oe_expand_button_hr"/>( )</a></li><li class="oe_i"><a id="oe_group_by_reset">P</a></li></ul></div>
|
||||
</t>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user