Commit 2838892b authored by Cédric Krier's avatar Cédric Krier
Browse files

Display the number of selected records on xxx2Many

Closes #11813
parent 24b69f1bd705
Pipeline #60105 passed with stages
in 1 minute and 2 seconds
* Display the number of selected records on xxx2Many
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -3626,13 +3626,15 @@
record_message: function(position, size) {
this._position = position;
this._length = size;
var name;
if (this._position) {
name = this._position;
} else {
name = '_';
}
var message = name + ' / ' + size;
var name = "_";
if (position) {
var selected = this.screen.selected_records.length;
name = ' ' + position;
if (selected > 1) {
name += '#' + selected;
}
}
var message = name + ' / ' + Sao.common.humanize(size);
this.label.text(message).attr('title', message);
this._set_button_sensitive();
},
......@@ -3763,6 +3765,12 @@
).appendTo(buttons);
this.but_add.click(this.add.bind(this));
this.label = jQuery('<span/>', {
'class': 'badge',
}).appendTo(jQuery('<span/>', {
'class': 'btn hidden-xs',
}).appendTo(buttons));
this.but_remove = jQuery('<button/>', {
'class': 'btn btn-default btn-sm',
'type': 'button',
......@@ -3844,5 +3852,5 @@
this.but_remove.prop('disabled', this._readonly ||
this._position === 0);
},
record_message: function(position) {
record_message: function(position, size) {
this._position = position;
......@@ -3848,4 +3856,14 @@
this._position = position;
var name = "_";
if (position) {
var selected = this.screen.selected_records.length;
name = ' ' + position;
if (selected > 1) {
name += '#' + selected;
}
}
var message = name + ' / ' + Sao.common.humanize(size);
this.label.text(message).attr('title', message);
this._set_button_sensitive();
},
display: function() {
......
* Display the number of selected records on xxx2Many
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
......
......@@ -72,6 +72,9 @@
self.but_add.set_relief(Gtk.ReliefStyle.NONE)
hbox.pack_start(self.but_add, expand=False, fill=False, padding=0)
self.label = Gtk.Label(label='(0/0)')
hbox.pack_start(self.label, expand=False, fill=False, padding=0)
self.but_remove = Gtk.Button(can_focus=False)
tooltips.set_tip(self.but_remove, _('Remove selected record'))
self.but_remove.connect('clicked', self._sig_remove)
......@@ -273,5 +276,5 @@
not self._readonly
and self._position))
def record_message(self, position, *args):
def record_message(self, position, size, *args):
self._position = position
......@@ -277,4 +280,10 @@
self._position = position
name = str(position) if position else '_'
selected = len(self.screen.selected_records)
if selected > 1:
name += '#%i' % selected
name = '(%s/%s)' % (name, common.humanize(size))
self.label.set_text(name)
self._set_button_sensitive()
def display(self):
......
......@@ -62,7 +62,7 @@
self.but_pre.set_relief(Gtk.ReliefStyle.NONE)
hbox.pack_start(self.but_pre, expand=False, fill=False, padding=0)
self.label = Gtk.Label(label='(0,0)')
self.label = Gtk.Label(label='(0/0)')
hbox.pack_start(self.label, expand=False, fill=False, padding=0)
self.but_next = Gtk.Button(can_focus=False)
......@@ -510,12 +510,12 @@
def record_message(self, position, size, *args):
self._position = position
self._length = size
if self._position:
name = str(self._position)
else:
name = '_'
line = '(%s/%s)' % (name, self._length)
self.label.set_text(line)
name = str(position) if position else '_'
selected = len(self.screen.selected_records)
if selected > 1:
name += '#%i' % selected
name = '(%s/%s)' % (name, common.humanize(size))
self.label.set_text(name)
self._set_button_sensitive()
def display(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment