fix find elements in manage names/titles dialogs

This commit is contained in:
rolux 2011-10-11 16:20:41 +00:00
parent a72633a350
commit 4c4cfb2423
2 changed files with 34 additions and 90 deletions

View file

@ -5,46 +5,32 @@ pandora.ui.namesDialog = function() {
width = 576 + Ox.UI.SCROLLBAR_SIZE, width = 576 + Ox.UI.SCROLLBAR_SIZE,
numberOfNames = 0, numberOfNames = 0,
$findSelect = Ox.Select({
items: [
{id: 'all', title: 'Find: All'}
],
overlap: 'right',
type: 'image'
})
.bindEvent({
change: function(data) {
var key = data.selected[0].id,
value = $findInput.value();
value && updateList(key, value);
$findInput.options({
placeholder: data.selected[0].title
});
}
}),
$findInput = Ox.Input({ $findInput = Ox.Input({
changeOnKeypress: true, changeOnKeypress: true,
clear: true, clear: true,
placeholder: 'Find: All', placeholder: 'Find',
width: 192 width: 192
}) })
.css({float: 'right', margin: '4px'})
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
var key = $findSelect.value(), var query = {
value = data.value; conditions: [
updateList(key, value); {key: 'name', value: data.value, operator: '='},
{key: 'sortname', value: data.value, operator: '='}
],
operator: '|'
};
$list.options({
items: function(data, callback) {
return pandora.api.findNames(Ox.extend(data, {
query: query
}), callback);
}
});
} }
}), }),
$findElement = Ox.FormElementGroup({
elements: [
$findSelect,
$findInput
]
})
.css({float: 'right', margin: '4px'}),
$list = Ox.TextList({ $list = Ox.TextList({
columns: [ columns: [
{ {
@ -120,7 +106,7 @@ pandora.ui.namesDialog = function() {
element: Ox.Bar({size: 24}) element: Ox.Bar({size: 24})
.append($status) .append($status)
.append( .append(
$findElement $findInput
), ),
size: 24 size: 24
}, },
@ -152,20 +138,6 @@ pandora.ui.namesDialog = function() {
}) })
.appendTo(that.$element.find('.OxButtonsbar')); .appendTo(that.$element.find('.OxButtonsbar'));
function updateList(key, value) {
var query = {
conditions: [{key: 'name', value: value, operator: '='}],
operator: '&'
};
$list.options({
items: function(data, callback) {
return pandora.api.findNames(Ox.extend(data, {
query: query
}), callback);
}
});
}
return that; return that;
}; };

View file

@ -5,46 +5,32 @@ pandora.ui.titlesDialog = function() {
width = 512 + Ox.UI.SCROLLBAR_SIZE, width = 512 + Ox.UI.SCROLLBAR_SIZE,
numberOfTitles = 0, numberOfTitles = 0,
$findSelect = Ox.Select({
items: [
{id: 'all', title: 'Find: All'}
],
overlap: 'right',
type: 'image'
})
.bindEvent({
change: function(data) {
var key = data.selected[0].id,
value = $findInput.value();
value && updateList(key, value);
$findInput.options({
placeholder: data.selected[0].title
});
}
}),
$findInput = Ox.Input({ $findInput = Ox.Input({
changeOnKeypress: true, changeOnKeypress: true,
clear: true, clear: true,
placeholder: 'Find: All', placeholder: 'Find',
width: 192 width: 192
}) })
.css({float: 'right', margin: '4px'})
.bindEvent({ .bindEvent({
change: function(data) { change: function(data) {
var key = $findSelect.value(), var query = {
value = data.value; conditions: [
updateList(key, value); {key: 'title', value: data.value, operator: '='},
{key: 'sorttitle', value: data.value, operator: '='}
],
operator: '|'
};
$list.options({
items: function(data, callback) {
return pandora.api.findTitles(Ox.extend(data, {
query: query
}), callback);
}
});
} }
}), }),
$findElement = Ox.FormElementGroup({
elements: [
$findSelect,
$findInput
]
})
.css({float: 'right', margin: '4px'}),
$list = Ox.TextList({ $list = Ox.TextList({
columns: [ columns: [
{ {
@ -111,7 +97,7 @@ pandora.ui.titlesDialog = function() {
element: Ox.Bar({size: 24}) element: Ox.Bar({size: 24})
.append($status) .append($status)
.append( .append(
$findElement $findInput
), ),
size: 24 size: 24
}, },
@ -143,20 +129,6 @@ pandora.ui.titlesDialog = function() {
}) })
.appendTo(that.$element.find('.OxButtonsbar')); .appendTo(that.$element.find('.OxButtonsbar'));
function updateList(key, value) {
var query = {
conditions: [{key: 'title', value: value, operator: '='}],
operator: '&'
};
$list.options({
items: function(data, callback) {
return pandora.api.findTitles(Ox.extend(data, {
query: query
}), callback);
}
});
}
return that; return that;
}; };