diff --git a/static/js/pandora/ui/namesDialog.js b/static/js/pandora/ui/namesDialog.js index 7708025b5..ee7cbc1b0 100644 --- a/static/js/pandora/ui/namesDialog.js +++ b/static/js/pandora/ui/namesDialog.js @@ -5,46 +5,32 @@ pandora.ui.namesDialog = function() { width = 576 + Ox.UI.SCROLLBAR_SIZE, 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({ changeOnKeypress: true, clear: true, - placeholder: 'Find: All', + placeholder: 'Find', width: 192 }) + .css({float: 'right', margin: '4px'}) .bindEvent({ change: function(data) { - var key = $findSelect.value(), - value = data.value; - updateList(key, value); + var query = { + conditions: [ + {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({ columns: [ { @@ -120,7 +106,7 @@ pandora.ui.namesDialog = function() { element: Ox.Bar({size: 24}) .append($status) .append( - $findElement + $findInput ), size: 24 }, @@ -152,20 +138,6 @@ pandora.ui.namesDialog = function() { }) .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; }; diff --git a/static/js/pandora/ui/titlesDialog.js b/static/js/pandora/ui/titlesDialog.js index 975fa45b5..e50081739 100644 --- a/static/js/pandora/ui/titlesDialog.js +++ b/static/js/pandora/ui/titlesDialog.js @@ -5,46 +5,32 @@ pandora.ui.titlesDialog = function() { width = 512 + Ox.UI.SCROLLBAR_SIZE, 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({ changeOnKeypress: true, clear: true, - placeholder: 'Find: All', + placeholder: 'Find', width: 192 }) + .css({float: 'right', margin: '4px'}) .bindEvent({ change: function(data) { - var key = $findSelect.value(), - value = data.value; - updateList(key, value); + var query = { + conditions: [ + {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({ columns: [ { @@ -111,7 +97,7 @@ pandora.ui.titlesDialog = function() { element: Ox.Bar({size: 24}) .append($status) .append( - $findElement + $findInput ), size: 24 }, @@ -143,20 +129,6 @@ pandora.ui.titlesDialog = function() { }) .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; };