mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed posix group checkbox.
In the adder dialog for groups the checkbox has been modified to use the correct field name "nonposix" and be checked by default. Note: This is a temporary fix to minimize the changes due to release schedule. Eventually the field label will be changed into "Non-POSIX group" and the checkbox will be unchecked by default, which is more consistent with CLI. Ticket #1799
This commit is contained in:
@@ -92,13 +92,28 @@ IPA.entity_factories.group = function () {
|
|||||||
'cn',
|
'cn',
|
||||||
'description',
|
'description',
|
||||||
{
|
{
|
||||||
factory:IPA.checkbox_widget,
|
factory: IPA.group_nonposix_checkbox_widget,
|
||||||
name: 'posix',
|
name: 'nonposix',
|
||||||
label: IPA.messages.objects.group.posix,
|
label: IPA.messages.objects.group.posix,
|
||||||
undo: false,
|
undo: false,
|
||||||
checked: 'checked'
|
checked: true
|
||||||
},
|
},
|
||||||
'gidnumber']
|
'gidnumber']
|
||||||
}).
|
}).
|
||||||
build();
|
build();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
IPA.group_nonposix_checkbox_widget = function (spec) {
|
||||||
|
|
||||||
|
spec = spec || {};
|
||||||
|
|
||||||
|
var that = IPA.checkbox_widget(spec);
|
||||||
|
|
||||||
|
that.save = function() {
|
||||||
|
var value = that.checkbox_save()[0];
|
||||||
|
// convert posix into non-posix
|
||||||
|
return [!value];
|
||||||
|
};
|
||||||
|
|
||||||
|
return that;
|
||||||
|
};
|
||||||
@@ -241,7 +241,7 @@ test("Testing checkbox widget.", function() {
|
|||||||
spec = {name:'title'};
|
spec = {name:'title'};
|
||||||
base_widget_test('test_value');
|
base_widget_test('test_value');
|
||||||
|
|
||||||
mock_record = {'title':'something'};
|
mock_record = { 'title': 'TRUE' };
|
||||||
|
|
||||||
widget.load(mock_record);
|
widget.load(mock_record);
|
||||||
same(widget.save(),[true], "Checkbox is set");
|
same(widget.save(),[true], "Checkbox is set");
|
||||||
|
|||||||
@@ -760,9 +760,11 @@ IPA.multivalued_text_widget = function(spec) {
|
|||||||
IPA.checkbox_widget = function (spec) {
|
IPA.checkbox_widget = function (spec) {
|
||||||
|
|
||||||
spec = spec || {};
|
spec = spec || {};
|
||||||
|
|
||||||
var that = IPA.widget(spec);
|
var that = IPA.widget(spec);
|
||||||
|
|
||||||
that.checked = spec.checked || '';
|
// default value
|
||||||
|
that.checked = spec.checked || false;
|
||||||
|
|
||||||
that.create = function(container) {
|
that.create = function(container) {
|
||||||
|
|
||||||
@@ -773,7 +775,7 @@ IPA.checkbox_widget = function (spec) {
|
|||||||
that.input = $('<input/>', {
|
that.input = $('<input/>', {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
name: that.name,
|
name: that.name,
|
||||||
checked : that.checked,
|
checked: that.checked,
|
||||||
title: that.tooltip,
|
title: that.tooltip,
|
||||||
change: function() {
|
change: function() {
|
||||||
that.set_dirty(that.test_dirty());
|
that.set_dirty(that.test_dirty());
|
||||||
@@ -786,6 +788,7 @@ IPA.checkbox_widget = function (spec) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
that.load = function(record) {
|
that.load = function(record) {
|
||||||
|
that.widget_load(record);
|
||||||
that.values = record[that.name] || [false];
|
that.values = record[that.name] || [false];
|
||||||
that.reset();
|
that.reset();
|
||||||
};
|
};
|
||||||
@@ -796,17 +799,29 @@ IPA.checkbox_widget = function (spec) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
that.update = function() {
|
that.update = function() {
|
||||||
var value = that.values && that.values.length ? that.values[0] : false;
|
var value;
|
||||||
if (value ==="FALSE"){
|
|
||||||
value = false;
|
if (that.values && that.values.length) {
|
||||||
|
// use loaded value
|
||||||
|
value = that.values[0];
|
||||||
|
} else {
|
||||||
|
// use default value
|
||||||
|
value = that.checked;
|
||||||
}
|
}
|
||||||
if (value ==="TRUE"){
|
|
||||||
|
// convert string into boolean
|
||||||
|
if (value === 'TRUE') {
|
||||||
value = true;
|
value = true;
|
||||||
|
} else if (value === 'FALSE') {
|
||||||
|
value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
that.input.attr('checked', value);
|
that.input.attr('checked', value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.checkbox_save = that.save;
|
||||||
|
that.checkbox_load = that.load;
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user