[FIX] reintroduce little arrows indicating the current sorting orientation in list views

bzr revid: xmo@openerp.com-20110713111815-v0rhnt31vykx2xcu
This commit is contained in:
Xavier Morel
2011-07-13 13:18:15 +02:00
parent d1209c847b
commit 3496acfab4
3 changed files with 18 additions and 11 deletions
+6 -2
View File
@@ -609,10 +609,14 @@ background: linear-gradient(top, #ffffff 0%,#d8d8d8 11%,#afafaf 86%,#333333 91%,
.openerp .oe-listview td.oe-record-delete {
text-align: right;
}
.openerp .oe-listview th.oe-sortable,
.openerp .oe-listview th.oe-sortable .ui-icon {
.openerp .oe-listview th.oe-sortable {
cursor: pointer;
}
.openerp .oe-listview th.oe-sortable .ui-icon {
height: 1em;
display: inline;
display: inline-block;
}
.openerp .oe-listview .oe-field-cell {
cursor: pointer;
+10 -5
View File
@@ -192,8 +192,6 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
this.setup_columns(this.fields_view.fields, grouped);
if (!this.fields_view.sorted) { this.fields_view.sorted = {}; }
this.$element.html(QWeb.render("ListView", this));
// Head hook
@@ -203,12 +201,19 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
this.$element.find('.oe-list-delete')
.attr('disabled', true)
.click(this.do_delete_selected);
this.$element.find('thead').delegate('th[data-id]', 'click', function (e) {
this.$element.find('thead').delegate('th.oe-sortable[data-id]', 'click', function (e) {
e.stopPropagation();
self.dataset.sort($(this).data('id'));
var $this = $(this);
self.dataset.sort($this.data('id'));
if ($this.find('span').length) {
$this.find('span').toggleClass(
'ui-icon-triangle-1-s ui-icon-triangle-1-n');
} else {
$this.append('<span class="ui-icon ui-icon-triangle-1-s">')
.siblings('.oe-sortable').find('span').remove();
}
// TODO: should only reload content (and set the right column to a sorted display state)
self.reload_content();
});
+2 -4
View File
@@ -283,10 +283,8 @@
<t t-foreach="columns" t-as="column">
<th t-if="!column.meta and column.invisible !== '1'" t-att-data-id="column.id"
t-att-class="((options.sortable and column.tag !== 'button') ? 'oe-sortable' : null)">
<t t-if="column.tag !== 'button'">
<t t-esc="column.string"/>
<span t-att-class="(fields_view.sorted.field === column.id) ? ('ui-icon' + (fields_view.sorted.reversed ? ' ui-icon-triangle-1-n' : ' ui-icon-triangle-1-s')) : ''"/>
</t>
<t t-if="column.tag !== 'button'"
><t t-esc="column.string"/></t>
</th>
</t>
<th t-if="options.deletable" width="1"/>