From d567ba23adf298898161a2b7e2bbed5a91030202 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 24 Jun 2011 13:13:39 +0200 Subject: [PATCH] [ADD] display inactive pager on group title rows in grouped lists bzr revid: xmo@openerp.com-20110624111339-2jh8gm8r2l33iifb --- addons/base/static/src/css/base.css | 11 +++++++++ addons/base/static/src/js/list.js | 35 +++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/addons/base/static/src/css/base.css b/addons/base/static/src/css/base.css index 6f679d4b125..0fdc2a8c5a4 100644 --- a/addons/base/static/src/css/base.css +++ b/addons/base/static/src/css/base.css @@ -613,6 +613,9 @@ background: linear-gradient(top, #ffffff 0%,#d8d8d8 11%,#afafaf 86%,#333333 91%, vertical-align: middle; text-align: left; } +.openerp .oe-listview td.oe-record-delete { + text-align: right; +} .openerp .oe-listview th.oe-sortable, .openerp .oe-listview th.oe-sortable .ui-icon { cursor: pointer; @@ -647,6 +650,14 @@ background: linear-gradient(top, #ffffff 0%,#d8d8d8 11%,#afafaf 86%,#333333 91%, cursor: pointer; } +.openerp .oe-listview .oe-group-name { + padding-right: 1em; +} +.openerp .oe-listview .oe-group-name, +.openerp .oe-listview .oe-group-pagination { + white-space: nowrap; +} + .openerp .oe-listview tfoot td { padding: 3px 3px 0; } diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js index 7c312f3fd83..0d3096a7dcd 100644 --- a/addons/base/static/src/js/list.js +++ b/addons/base/static/src/js/list.js @@ -787,14 +787,9 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr this.columns = view.columns; this.datagroup = null; - this.sections = []; + this.$row = null; this.children = {}; }, - pad: function ($row) { - if (this.options.selectable) { - $row.append(''); - } - }, make_fragment: function () { return document.createDocumentFragment(); }, @@ -827,8 +822,13 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr }, open: function (point_insertion) { this.render().insertAfter(point_insertion); + this.$row.children().last() + .append('') + .append('') + .append(''); }, close: function () { + this.$row.children().last().empty(); this.apoptosis(); }, /** @@ -860,7 +860,7 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr self.bind_child_events(child); child.datagroup = group; - var $row = $(''); + var $row = child.$row = $(''); if (group.openable) { $row.click(function (e) { if (!$row.data('open')) { @@ -880,7 +880,7 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr } placeholder.appendChild($row[0]); - var $group_column = $('').appendTo($row); + var $group_column = $('').appendTo($row); if (group.grouped_on) { // Don't fill this if group_by_no_leaf but no group_by $group_column @@ -895,7 +895,9 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr // count column $('').text(group.length).appendTo($row); - self.pad($row); + if (self.options.selectable) { + $row.append(''); + } _(self.columns).chain() .filter(function (column) {return !column.invisible;}) .each(function (column) { @@ -916,6 +918,9 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr $row.append(''); } }); + if (self.options.deletable) { + $row.append(''); + } }); return placeholder; }, @@ -957,6 +962,18 @@ openerp.base.ListView.Groups = Class.extend( /** @lends openerp.base.ListView.Gr function (records) { if (!self.datagroup.openable) { view.configure_pager(dataset); + } else { + var page = 1, + pages = Math.ceil(dataset.ids.length / limit); + self.$row + .find('.oe-pager-state') + .text(_.sprintf('%d/%d', page, pages)) + .end() + .find('button[data-pager-action=previous]') + .attr('disabled', page === 1) + .end() + .find('button[data-pager-action=next]') + .attr('disabled', page === pages); } var form_records = _(records).map(