1) Ensure Boolean columns should be editable using keyboard keys. Fixes #3778

2) Ensure Boolean columns should be editable in View/Edit data and Query Tool. Fixes #4487
This commit is contained in:
Aditya Toshniwal 2019-08-28 11:09:30 +05:30 committed by Akshay Joshi
parent dbbbb2e5ed
commit 06ad6b8ba8
2 changed files with 22 additions and 12 deletions

View File

@ -23,7 +23,9 @@ Bug fixes
| `Issue #2706 <https://redmine.postgresql.org/issues/2706>`_ - Added ProjectSet icon for explain module.
| `Issue #2828 <https://redmine.postgresql.org/issues/2828>`_ - Added Gather Merge, Named Tuple Store Scan and Table Function Scan icon for explain module.
| `Issue #3778 <https://redmine.postgresql.org/issues/3778>`_ - Ensure Boolean columns should be editable using keyboard keys.
| `Issue #4419 <https://redmine.postgresql.org/issues/4419>`_ - Fix a debugger error when using Python 2.7.
| `Issue #4487 <https://redmine.postgresql.org/issues/4487>`_ - Ensure Boolean columns should be editable in View/Edit data and Query Tool.
| `Issue #4577 <https://redmine.postgresql.org/issues/4577>`_ - Fix an error that could be seen when click on any system column of a table.
| `Issue #4584 <https://redmine.postgresql.org/issues/4584>`_ - Unescape HTML entities in database names in the Query Tool title bar.
| `Issue #4643 <https://redmine.postgresql.org/issues/4643>`_ - Fix Truncate option deselect issue for compound triggers.

View File

@ -886,27 +886,35 @@ import gettext from 'sources/gettext';
// Custom checkbox editor, We need it for runtime as it does not render
// indeterminate checkbox state
function pgCheckboxEditor(args) {
var $select, el;
var $select;
var defaultValue, previousState;
this.init = function() {
$select = $('<div class=\'multi-checkbox\'><span class=\'check\' hideFocus></span></div>');
$select = $('<div class=\'multi-checkbox\' tabindex="0"><span class=\'check\' hideFocus></span></div>');
$select.appendTo(args.container);
$select.trigger('focus');
// The following code is taken from https://css-tricks.com/indeterminate-checkboxes/
$select.on('click', function() {
el = $(this);
var states = ['unchecked', 'partial', 'checked'];
var curState = el.find('.check').data('state');
curState++;
el.find('.check')
.removeClass('unchecked partial checked')
.addClass(states[curState % states.length])
.data('state', curState % states.length);
$select.on('click', this.changeValue);
$select.on('keydown', (e) => {
if (e.which == $.ui.keyCode.SPACE) {
e.preventDefault();
this.changeValue(e);
}
});
};
this.changeValue = function() {
// The following code is taken from https://css-tricks.com/indeterminate-checkboxes/
var states = ['unchecked', 'partial', 'checked'];
var curState = $select.find('.check').data('state') || 0;
curState++;
$select.find('.check')
.removeClass('unchecked partial checked')
.addClass(states[curState % states.length])
.data('state', curState % states.length);
};
this.destroy = function() {
$select.remove();
};