summaryrefslogtreecommitdiffstats
path: root/install/ui
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-02-02 10:35:23 -0600
committerAdam Young <ayoung@redhat.com>2011-02-02 15:56:50 -0500
commitd389e054f6173194daabc08ad3abd366005048bd (patch)
treeb1f0bf85e7095c6215c8989a8c720da81d46104c /install/ui
parent0353a2be677594125892e16fe0cdebe264d2ccb2 (diff)
downloadfreeipa-d389e054f6173194daabc08ad3abd366005048bd.tar.gz
freeipa-d389e054f6173194daabc08ad3abd366005048bd.tar.xz
freeipa-d389e054f6173194daabc08ad3abd366005048bd.zip
Added undo for permission target.
https://fedorahosted.org/freeipa/ticket/885
Diffstat (limited to 'install/ui')
-rw-r--r--install/ui/aci.js314
-rw-r--r--install/ui/dialog.js2
-rw-r--r--install/ui/ipa.css6
-rw-r--r--install/ui/test/aci_tests.js95
-rw-r--r--install/ui/widget.js39
5 files changed, 269 insertions, 187 deletions
diff --git a/install/ui/aci.js b/install/ui/aci.js
index 67c2d5f87..036731237 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -24,7 +24,7 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, entity.js */
-IPA.attribute_table_widget = function(spec) {
+IPA.attributes_widget = function(spec) {
spec = spec || {};
@@ -35,38 +35,43 @@ IPA.attribute_table_widget = function(spec) {
var id = spec.name;
var dd_class = "other";
- that.create = function(container){
+ that.create = function(container) {
var dd = $('<dd/>', {
'class': dd_class
}).appendTo(container);
- var span = $('<span/>', {
- name: 'attrs'
- }).appendTo(dd);
-
that.table = $('<table/>', {
id:id,
- 'class':'search-table aci-attribute-table'}).
+ 'class':'search-table aci-attribute-table'
+ }).
append('<thead/>').
- append($('<tbody/>')).
- appendTo(span);
+ append('<tbody/>').
+ appendTo(dd);
var tr = $('<tr></tr>').appendTo($('thead', that.table));
- tr.append($('<th/>',{
+ tr.append($('<th/>', {
style:"height:2em; vertical-align:bottom;",
html:$('<input/>',{
type: "checkbox",
click: function(){
$('.aci-attribute').
attr('checked', $(this).attr('checked'));
- }})
+ },
+ change: function() {
+ that.show_undo();
+ }
+ })
})).
append('<th class="aci-attribute-column">Attribute</th>');
+
+ if (that.undo) {
+ that.create_undo(dd);
+ }
+
if (that.object_type){
that.populate (that.object_type);
}
-
};
that.load = function(record) {
@@ -85,11 +90,11 @@ IPA.attribute_table_widget = function(spec) {
that.update = function() {
that.populate(that.object_type);
- that.checkboxes_update();
that.append();
+ that.checkboxes_update();
};
- that.populate = function(object_type){
+ that.populate = function(object_type) {
$('tbody tr', that.table).remove();
@@ -100,22 +105,21 @@ IPA.attribute_table_widget = function(spec) {
var aciattrs = metadata.aciattrs;
- var attr_per_col = 400;
- var col_span = aciattrs.length / attr_per_col + 1;
-
var tbody = $('tbody', that.table);
- var td;
- for (var a = 0; a < aciattrs.length ; a += 1){
- var value = aciattrs[a].toLowerCase();
- var aci_tr = $('<tr/>').appendTo(tbody);
- td = $('<td/>').appendTo(aci_tr);
+ for (var i=0; i<aciattrs.length ; i++){
+ var value = aciattrs[i].toLowerCase();
+ var aci_tr = $('<tr/>').appendTo(tbody);
+
+ var td = $('<td/>').appendTo(aci_tr);
td.append($('<input/>',{
type: 'checkbox',
- id: 'aciattr-'+value,
- name: 'attrs',
+ name: that.name,
value: value,
- 'class': 'aci-attribute'
+ 'class': 'aci-attribute',
+ change: function() {
+ that.show_undo();
+ }
}));
td = $('<td/>').appendTo(aci_tr);
td.append($('<label/>',{
@@ -130,14 +134,13 @@ IPA.attribute_table_widget = function(spec) {
var unmatched = [];
for (var i=0; i<that.values.length; i++) {
- var cb = $('#aciattr-'+that.values[i]);
- if (!cb.length){
+ var input = $('input[name="'+that.name+'"][value="'+that.values[i]+'"]', that.container);
+ if (!input.length) {
unmatched.push(that.values[i]);
}
- cb.attr('checked',true);
}
- if (unmatched.length > 0){
+ if (unmatched.length > 0) {
var tbody = $('tbody', that.table);
for (var j=0; j<unmatched.length; j++) {
@@ -147,11 +150,12 @@ IPA.attribute_table_widget = function(spec) {
var td = $('<td/>').appendTo(tr);
td.append($('<input/>', {
type: 'checkbox',
- checked: true,
- id: 'aciattr-'+value,
- name: 'attrs',
+ name: that.name,
value: value,
- 'class': 'aci-attribute'
+ 'class': 'aci-attribute',
+ change: function() {
+ that.show_undo();
+ }
}));
td = $('<td/>').appendTo(tr);
@@ -165,47 +169,24 @@ IPA.attribute_table_widget = function(spec) {
return that;
};
-
-
-IPA.type_widget = function(spec) {
-
- spec = spec || {};
-
- var that = IPA.select_widget(spec);
-
- that.filter = spec.filter || '';
-
- that.create = function(container) {
- that.select = $('<select/>', {
- name: that.name,
- id: 'object_type_select'
- }).appendTo(container);
- };
-
- return that;
-};
-
-
-
-IPA.rights_widget = function(spec){
- var rights = ['write','add','delete'];
+IPA.rights_widget = function(spec) {
var that = IPA.checkboxes_widget(spec);
- that.id = spec.id;
+
+ that.rights = ['write', 'add', 'delete'];
that.create = function(container){
- for (var i = 0; i < rights.length; i++){
+ for (var i = 0; i<that.rights.length; i++) {
$('<dd/>').
append($('<input/>', {
type: 'checkbox',
- id: rights[i],
name: that.name,
- value: rights[i],
+ value: that.rights[i],
'class': that.entity_name +'_'+ that.name
})).
append($('<label/>', {
- text: rights[i]
+ text: that.rights[i]
})).
appendTo(container);
}
@@ -220,7 +201,7 @@ IPA.rights_widget = function(spec){
};
-IPA.hidden_widget = function(spec){
+IPA.hidden_widget = function(spec) {
spec.label = '';
var that = IPA.widget(spec);
that.id = spec.id;
@@ -244,7 +225,7 @@ IPA.hidden_widget = function(spec){
};
-IPA.rights_section = function () {
+IPA.rights_section = function() {
var spec = {
'name':'rights',
'label': 'Rights'
@@ -256,20 +237,19 @@ IPA.rights_section = function () {
};
-IPA.target_section = function () {
+IPA.target_section = function(spec) {
- var spec = {
- 'name':'target',
- 'label': 'Target'
- };
+ spec = spec || {};
var that = IPA.details_section(spec);
+ that.undo = typeof spec.undo == 'undefined' ? true : spec.undo;
+
var groupings = ['aci_by_type', 'aci_by_query', 'aci_by_group',
'aci_by_filter' ];
var inputs = ['input', 'select', 'textarea'];
- function disable_inputs(){
+ function disable_inputs() {
for (var g = 0; g < groupings.length; g += 1 ){
for (var t = 0 ; t < inputs.length; t += 1){
$('.' + groupings[g] + ' '+ inputs[t]).
@@ -277,14 +257,14 @@ IPA.target_section = function () {
}
}
}
- function enable_by(grouping){
+ function enable_by(grouping) {
for (var t = 0 ; t < inputs.length; t += 1){
$('.' + grouping + ' '+ inputs[t]).
attr('disabled', '');
}
}
- function display_filter_target(dl){
+ function display_filter_target(dl) {
$('<dt/>').
append($('<input/>', {
type: 'radio',
@@ -297,25 +277,21 @@ IPA.target_section = function () {
})).
appendTo(dl);
- $('<dd/>', {
- 'class': 'aci_by_filter first'
+ var span = $('<span/>', {
+ name: 'filter'
}).
- append(
- $('<span/>', {
- name: 'filter'
- }).
- append(
- $('<input/>', {
- name: 'filter',
- disabled: 'true',
- type: 'text',
- id: 'aci_filter'
- }))).
appendTo(dl);
+
+ var dd = $('<dd/>', {
+ 'class': 'aci_by_filter first'
+ }).
+ appendTo(span);
+
+ that.filter_text.create(dd);
}
- function display_type_target(dl){
+ function display_type_target(dl) {
$('<dt/>').
append($('<input/>', {
type: 'radio',
@@ -338,31 +314,14 @@ IPA.target_section = function () {
that.type_select.create(span);
- var select = that.type_select.select;
- select.change(function() {
- that.attribute_table.object_type = this.options[this.selectedIndex].value;
- that.attribute_table.reset();
- });
-
- select.append($('<option/>', {
- value: '',
- text: ''
- }));
-
- var type_params = IPA.get_param_info('permission', 'type');
- for (var pc =0; pc < type_params.values.length; pc += 1){
- select.append($('<option/>', {
- value: type_params.values[pc],
- text: type_params.values[pc]
- }));
- }
-
- that.attribute_table = that.get_field('attrs');
+ span = $('<span/>', {
+ name: 'attrs'
+ }).appendTo(dl);
- that.attribute_table.create(dl);
+ that.attribute_table.create(span);
}
- function display_query_target(dl){
+ function display_query_target(dl) {
$('<dt/>').
append($('<input/>', {
type: 'radio',
@@ -374,25 +333,19 @@ IPA.target_section = function () {
})).
appendTo(dl);
- $('<dd/>', {
- 'class': 'aci_by_query first'
- }).append(
- $('<span/>', {
- name: 'subtree'
- }).append(
- $('<textarea/>', {
- name: 'subtree',
- id: 'aci_query_text',
- cols: '30',
- rows: '1'
- }))).
- appendTo(dl);
- }
+ var span = $('<span/>', {
+ name: 'subtree'
+ }).appendTo(dl);
- function display_group_target(dl){
+ var dd = $('<dd/>', {
+ 'class': 'aci_by_query first'
+ }).appendTo(span);
+ that.subtree_textarea.create(dd);
+ }
- $('<dt/>' ).
+ function display_group_target(dl) {
+ $('<dt/>').
append($('<input />', {
type: 'radio',
name: 'aci_type',
@@ -403,17 +356,15 @@ IPA.target_section = function () {
})).
appendTo(dl);
-
var span = $('<span/>', {
name: 'targetgroup'
}).appendTo(dl);
- var dd = $('<dd/>', {
+ var dd = $('<dd/>', {
'class': 'aci_by_group first'
}).
appendTo(span);
-
that.group_select.create(dd);
}
@@ -427,22 +378,22 @@ IPA.target_section = function () {
display_group_target(dl);
display_type_target(dl);
- $('#aci_by_filter', dl).click(function (){
+ $('#aci_by_filter', dl).click(function() {
disable_inputs();
enable_by(groupings[3]);
});
- $('#aci_by_type', dl).click(function (){
+ $('#aci_by_type', dl).click(function() {
disable_inputs();
enable_by(groupings[0]);
});
- $('#aci_by_query', dl).click(function (){
+ $('#aci_by_query', dl).click(function() {
disable_inputs();
enable_by(groupings[1]);
});
- $('#aci_by_group', dl).click(function (){
+ $('#aci_by_group', dl).click(function() {
disable_inputs();
enable_by(groupings[2]);
});
@@ -452,6 +403,32 @@ IPA.target_section = function () {
that.setup = function(container) {
that.section_setup(container);
+
+ var select = that.type_select.select;
+
+ select.change(function() {
+ that.attribute_table.object_type = that.type_select.save()[0];
+ that.attribute_table.reset();
+ });
+
+ select.append($('<option/>', {
+ value: '',
+ text: ''
+ }));
+
+ var type_params = IPA.get_param_info('permission', 'type');
+ for (var i=0; i<type_params.values.length; i++){
+ select.append($('<option/>', {
+ value: type_params.values[i],
+ text: type_params.values[i]
+ }));
+ }
+
+ that.type_select.update = function() {
+ that.type_select.select_update();
+ that.attribute_table.object_type = that.type_select.save()[0];
+ that.attribute_table.reset();
+ };
};
function set_aci_type(record) {
@@ -489,34 +466,43 @@ IPA.target_section = function () {
};
that.init = function() {
- that.add_field(IPA.text_widget({name: 'filter'}));
- that.add_field(IPA.textarea_widget({name: 'subtree'}));
+ that.filter_text = IPA.text_widget({name: 'filter', undo: that.undo});
+ that.add_field(that.filter_text);
+
+ that.subtree_textarea = IPA.textarea_widget({
+ name: 'subtree',
+ cols: 30, rows: 1,
+ undo: that.undo
+ });
+ that.add_field(that.subtree_textarea);
that.group_select = IPA.entity_select_widget(
- {name: 'targetgroup', entity:'group'});
+ {name: 'targetgroup', entity:'group', undo: that.undo});
that.add_field(that.group_select);
- that.type_select = IPA.type_widget({name: 'type'});
+ that.type_select = IPA.select_widget({name: 'type', undo: that.undo});
that.add_field(that.type_select);
- that.attribute_table = IPA.attribute_table_widget({name: 'attrs'});
+ that.attribute_table = IPA.attributes_widget({name: 'attrs', undo: that.undo});
that.add_field(that.attribute_table);
};
- that.save = function (record){
+ that.save = function(record) {
var record_type = $("input[name='aci_type']:checked").attr('id');
- if (record_type === 'aci_by_group'){
+ if (record_type === 'aci_by_group') {
record.targetgroup = that.group_select.save()[0];
- }else if (record_type === 'aci_by_type'){
- record.type = $('#object_type_select option:selected').val();
+
+ } else if (record_type === 'aci_by_type') {
+ record.type = that.type_select.save()[0];
record.attrs = that.attribute_table.save().join(',');
- }else if (record_type === 'aci_by_query'){
- record.subtree = $('#aci_query_text').val();
- }else if (record_type === 'aci_by_filter'){
- var filter = $('#aci_filter').val();
- record.filter = filter;
+
+ } else if (record_type === 'aci_by_query') {
+ record.subtree = that.subtree_textarea.save([0]);
+
+ } else if (record_type === 'aci_by_filter') {
+ record.filter = that.filter_text.save()[0];
}
};
@@ -557,7 +543,7 @@ IPA.permission_details_facet = function(spec) {
return that;
};
-IPA.entity_factories.permission = function () {
+IPA.entity_factories.permission = function() {
return IPA.entity({
'name': 'permission'
@@ -572,7 +558,7 @@ IPA.entity_factories.permission = function () {
undo: false
})).
field(IPA.rights_widget({name: 'permissions', label: 'Permissions', join: true, undo: false})).
- section(IPA.target_section())).
+ section(IPA.target_section({name: 'target', label: 'Target', undo: false}))).
facet(IPA.search_facet().
column({name:'cn'})).
facet(IPA.permission_details_facet({ name: 'details' }).
@@ -580,12 +566,12 @@ IPA.entity_factories.permission = function () {
IPA.stanza({name:'identity', label:'Identity'}).
input({name: 'cn', 'read_only': true})).
section(IPA.rights_section()).
- section(IPA.target_section()));
+ section(IPA.target_section({name: 'target', label: 'Target'})));
};
-IPA.entity_factories.privilege = function() {
+IPA.entity_factories.privilege = function() {
var that = IPA.entity({
'name': 'privilege'
}).
@@ -619,7 +605,7 @@ IPA.entity_factories.privilege = function() {
};
-IPA.entity_factories.role = function() {
+IPA.entity_factories.role = function() {
return IPA.entity({
'name': 'role'
}).
@@ -648,7 +634,7 @@ IPA.entity_factories.role = function() {
};
-IPA.entity_factories.selfservice = function() {
+IPA.entity_factories.selfservice = function() {
return IPA.entity({
'name': 'selfservice'
}).
@@ -659,7 +645,7 @@ IPA.entity_factories.selfservice = function() {
section(
IPA.stanza({name:'general', label:'General'}).
input({name:'aciname'}).
- custom_input(IPA.attribute_table_widget({
+ custom_input(IPA.attributes_widget({
object_type:'user',
name:'attrs'
})))).
@@ -669,14 +655,14 @@ IPA.entity_factories.selfservice = function() {
title: 'Add Self Service Definition'
}).
field(IPA.text_widget({ name: 'aciname', undo: false})).
- field(IPA.attribute_table_widget({
+ field(IPA.attributes_widget({
object_type:'user',
name:'attrs'
})));
};
-IPA.entity_factories.delegation = function() {
+IPA.entity_factories.delegation = function() {
var that = IPA.entity({
'name': 'delegation'
}).facet(
@@ -694,20 +680,22 @@ IPA.entity_factories.delegation = function() {
entity:'group', join: true})).
custom_input(
IPA.rights_widget({name: 'permissions', label: 'Permissions',
- id:'delegation_rights', join: true})).
+ join: true})).
custom_input(
- IPA.attribute_table_widget({
+ IPA.attributes_widget({
name:'attrs', object_type:'user', join: true})))).
add_dialog(IPA.add_dialog({
name: 'add',
- title: 'Add Delegation'
+ title: 'Add Delegation',
+ width: '700px'
}).
- field(IPA.text_widget({ name: 'aciname', undo: false})).
- field(IPA.entity_select_widget({name:'group',
- entity:'group'})).
- field(IPA.entity_select_widget({name:'memberof',
- entity:'group', join: true})).
- field(IPA.attribute_table_widget({ name: 'attrs', object_type:'user', join: true}))).
+ field(IPA.text_widget({ name: 'aciname', undo: false})).
+ field(IPA.entity_select_widget({name:'group',
+ entity:'group', undo: false})).
+ field(IPA.entity_select_widget({name:'memberof', entity:'group',
+ join: true, undo: false})).
+ field(IPA.attributes_widget({ name: 'attrs', object_type:'user',
+ join: true, undo: false}))).
standard_associations();
return that;
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index c2640267a..b1f84a98b 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -157,7 +157,7 @@ IPA.dialog = function(spec) {
field.setup(span);
}
- for (var j = 0; i<that.sections.length; j++) {
+ for (var j=0; j<that.sections.length; j++) {
var section = that.sections[j];
var div = $('#'+that.entity_name+'-'+that.name+'-'+section.name,
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 6ba60dfff..8cde2fd14 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -308,12 +308,6 @@ dl.aci-target input {
}
-#aci_target_group_select {
- display: block;
- margin-left: 32em !important;
- margin-top: -4em;
-}
-
#group_filter {
margin-right: 2em;
}
diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js
index 1d9665990..d1a5cb6bf 100644
--- a/install/ui/test/aci_tests.js
+++ b/install/ui/test/aci_tests.js
@@ -19,8 +19,8 @@
*/
+var target_container;
var target_section;
-var aci_container;
module('aci',{
setup: function() {
@@ -29,23 +29,104 @@ module('aci',{
"data",
true,
function(data, text_status, xhr) {
- ok(true, "ipa_init() succeeded.");
},
function(xhr, text_status, error_thrown) {
ok(false, "ipa_init() failed: "+error_thrown);
}
);
- aci_container = $('<div id="aci"/>').appendTo(document.body);
- target_section = IPA.target_section();
+
+ target_container = $('<div id="target"/>').appendTo(document.body);
+ target_section = IPA.target_section({name: 'target', label: 'Target'});
target_section.init();
- target_section.create(aci_container);
+ target_section.create(target_container);
},
teardown: function() {
- aci_container.remove();
+ target_container.remove();
}}
);
+test("IPA.attributes_widget.", function() {
+
+ var aciattrs = IPA.metadata['user'].aciattrs;
+
+ var container = $('<span/>', {
+ name: 'attrs'
+ });
+
+ var widget = IPA.attributes_widget({
+ name: 'attrs',
+ object_type: 'user'
+ });
+
+ widget.init();
+ widget.create(container);
+ widget.setup(container);
+
+ var table = $('table', container);
+
+ ok(
+ table,
+ 'Widget contains table'
+ );
+
+ var tr = $('tbody tr', table);
+
+ same(
+ tr.length, aciattrs.length,
+ 'Widget contains all user ACI attributes'
+ );
+
+ var record = {
+ 'attrs': [
+ "unmatched",
+ "cn",
+ "description"
+ ]
+ };
+
+ same(
+ widget.save(), [],
+ 'Widget has no initial values'
+ );
+
+ widget.load(record);
+
+ tr = $('tbody tr', table);
+
+ same(
+ tr.length, aciattrs.length+1,
+ 'Widget contains all user ACI attributes plus 1 unmatched attribute'
+ );
+
+ same(
+ widget.save(), record.attrs.sort(),
+ 'All loaded values are saved and sorted'
+ );
+});
+
+test("IPA.rights_widget.", function() {
+
+ var container = $('<span/>', {
+ name: 'permissions'
+ });
+
+ var widget = IPA.rights_widget({
+ name: 'permissions'
+ });
+
+ widget.init();
+ widget.create(container);
+ widget.setup(container);
+
+ var inputs = $('input', container);
+
+ same(
+ inputs.length, widget.rights.length,
+ 'Widget displays all permissions'
+ );
+});
+
test("Testing aci grouptarget.", function() {
var sample_data_filter_only = {"targetgroup":"ipausers"};
target_section.load(sample_data_filter_only);
@@ -59,7 +140,7 @@ test("Testing aci grouptarget.", function() {
test("Testing aci object type.", function() {
var sample_data_filter_only = {"type":"hostgroup"};
target_section.load(sample_data_filter_only);
- ok($('.aci-attribute', aci_container).length > 4);
+ ok($('.aci-attribute', target_container).length > 4);
ok($('#aci_by_type')[0].checked, 'aci_by_type control selected');
});
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 9f6365a0b..8f3eeb62f 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -32,7 +32,10 @@ IPA.widget = function(spec) {
that.name = spec.name;
that.label = spec.label;
that.tooltip = spec.tooltip;
+
+ that.disabled = spec.disabled;
that.read_only = spec.read_only;
+
that._entity_name = spec.entity_name;
that.width = spec.width;
@@ -257,14 +260,18 @@ IPA.text_widget = function(spec) {
$('<input/>', {
type: 'text',
name: that.name,
+ disabled: that.disabled,
size: that.size,
title: that.tooltip
}).appendTo(container);
if (that.undo) {
+ container.append(' ');
that.create_undo(container);
}
+ container.append(' ');
+
$("<span/>",{
name:'error_link',
html:"Text does not match field pattern",
@@ -452,11 +459,11 @@ IPA.checkboxes_widget = function (spec) {
inputs.get(i).checked = false;
}
- for (var j=0; j<that.values.length; j++) {
+ for (var j=0; that.values && j<that.values.length; j++) {
var value = that.values[j];
var input = $('input[name="'+that.name+'"][value="'+value+'"]', that.container);
if (!input.length) continue;
- input.get(0).checked = true;
+ input.attr('checked', true);
}
};
@@ -521,13 +528,11 @@ IPA.radio_widget = function(spec) {
that.update = function() {
-
-
if (that.values) {
var value;
- if ((that.values instanceof Array ) && that.values.length){
- value = that.values[0]
- }else{
+ if ((that.values instanceof Array) && that.values.length) {
+ value = that.values[0];
+ } else {
value = that.values;
}
@@ -575,6 +580,7 @@ IPA.select_widget = function(spec) {
}
if (that.undo) {
+ container.append(' ');
that.create_undo(container);
}
};
@@ -623,6 +629,7 @@ IPA.select_widget = function(spec) {
// methods that should be invoked by subclasses
that.select_load = that.load;
that.select_save = that.save;
+ that.select_update = that.update;
return that;
};
@@ -639,13 +646,15 @@ IPA.textarea_widget = function (spec) {
that.create = function(container) {
$('<textarea/>', {
+ name: that.name,
rows: that.rows,
cols: that.cols,
- name: that.name,
+ disabled: that.disabled,
title: that.tooltip
}).appendTo(container);
if (that.undo) {
+ container.append(' ');
that.create_undo(container);
}
@@ -663,7 +672,7 @@ IPA.textarea_widget = function (spec) {
var input = $('textarea[name="'+that.name+'"]', that.container);
input.keyup(function() {
- undo.css('display', 'inline');
+ that.show_undo();
var value = $(this).val();
that.validate_input(value);
@@ -1055,6 +1064,7 @@ IPA.table_widget = function (spec) {
return that;
};
+
IPA.entity_select_widget = function(spec){
var that = IPA.widget(spec);
@@ -1064,6 +1074,14 @@ IPA.entity_select_widget = function(spec){
function populate_select(value){
function find_success(result){
$('option', that.entity_select).remove();
+
+ // add default empty value
+ $('<option/>', {
+ text: '',
+ value: ''
+ }).
+ appendTo(that.entity_select);
+
var entities = result.result.result;
for (var i =0; i < result.result.count; i +=1){
var entity = entities[i];
@@ -1155,7 +1173,8 @@ IPA.entity_select_widget = function(spec){
};
that.save = function(){
- return [$('option:selected', that.entity_select).val()];
+ var value = $('option:selected', that.entity_select).val();
+ return [value];
};
return that;