use new array input options

This commit is contained in:
rolux 2015-02-14 19:52:30 +00:00
parent 55bcb58f4c
commit 1e2e87ba84

View file

@ -676,54 +676,58 @@ pandora.ui.documentsPanel = function(options) {
].concat( ].concat(
pandora.site.entities && pandora.site.entities.length pandora.site.entities && pandora.site.entities.length
? Ox.ArrayInput({ ? Ox.ArrayInput({
getInput: function(width) { input: {
$input = Ox.FormElementGroup({ get: function(width) {
elements: [ return Ox.FormElementGroup({
Ox.Select({ elements: [
items: pandora.site.entities.map(function(entity) { Ox.Select({
return { items: pandora.site.entities.map(function(entity) {
id: entity.id, return {
title: entity.title id: entity.id,
}; title: entity.title
};
}),
overlap: 'right',
width: labelWidth
})
.bindEvent({
change: function() {
$input.value($input.value()[0], '');
}
}), }),
overlap: 'right', Ox.Input({
width: labelWidth autocomplete: function(value, callback) {
}) pandora.api.autocompleteEntities({
.bindEvent({ key: $input.value()[0],
change: function() { operator: '=',
$input.value($input.value()[0], ''); range: [0, 10],
} value: value
}), }, function(result) {
Ox.Input({ callback(result.data.items);
autocomplete: function(value, callback) { });
pandora.api.autocompleteEntities({ },
key: $input.value()[0], autocompleteReplace: true,
operator: '=', autocompleteSelect: true,
range: [0, 10], autocompleteSelectSubmit: true,
value: value width: width - labelWidth
}, function(result) { })
callback(result.data.items); ],
}); width: width
}, });
autocompleteReplace: true, },
autocompleteSelect: true, getEmpty: function() {
autocompleteSelectSubmit: true, return [pandora.site.entities[0].id, ''];
width: width - labelWidth },
}) isEmpty: function(value) {
], return value[1] === '';
width: width },
}); setWidth: function($input, width) {
return $input; $input.options('elements')[1].options({
}, width: width - labelWidth
isEmpty: function(value) { });
return value[1] === ''; }
}, }
label: Ox._('Entities'), label: Ox._('Entities'),
setWidth: function(width) {
$input.options('elements')[1].options({
width: width - labelWidth
});
},
value: item.entities.map(function(entity) { value: item.entities.map(function(entity) {
return [entity.type, entity.name]; return [entity.type, entity.name];
}), }),