From 7ac199a8795c25b5c18b4ae54c1bab3260e2d29d Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 8 Oct 2011 11:24:09 +0000 Subject: [PATCH] fix some bugs with find on home screen --- static/js/pandora/URL.js | 1 + static/js/pandora/ui/findElement.js | 8 ++++++++ static/js/pandora/ui/home.js | 10 +++++++++- static/js/pandora/utils.js | 1 + 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index e76f9449..a6965d44 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -372,6 +372,7 @@ pandora.URL = (function() { } else { if ( !pandora.$ui.appPanel + || (keys.length == 1 && keys[0] == 'span') || keys.every(function(key) { return /^videoPoints/.test(key); }) diff --git a/static/js/pandora/ui/findElement.js b/static/js/pandora/ui/findElement.js index b995aa9e..8f1d5bc6 100644 --- a/static/js/pandora/ui/findElement.js +++ b/static/js/pandora/ui/findElement.js @@ -113,6 +113,14 @@ pandora.ui.findElement = function() { .css({ float: 'right', margin: '4px' + }) + .bindEvent({ + // find may be changed from the home screen + pandora_find: function(data) { + pandora.$ui.findInput.options({ + value: data.value.conditions[0].value + }); + } }); function autocompleteFunction() { return pandora.user.ui.find.conditions.length ? function(value, callback) { diff --git a/static/js/pandora/ui/home.js b/static/js/pandora/ui/home.js index 7ccfe741..ee4f1350 100644 --- a/static/js/pandora/ui/home.js +++ b/static/js/pandora/ui/home.js @@ -107,7 +107,15 @@ pandora.ui.home = function() { click: function() { var folder = pandora.getListData().folder; folder && pandora.$ui.folderList[folder].options({selected: []}); - pandora.URL.push('/=' + $findInput.value()); + //pandora.URL.push('/=' + $findInput.value()); + pandora.UI.set('find', { + conditions: [{ + key: '*', + value: $findInput.value(), + operator: '=' + }], + operator: '&' + }); that.fadeOutScreen(); } }) diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 4b2fcba5..859decdf 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -750,6 +750,7 @@ pandora.selectList = function() { // has a findKey as key and "=" as operator (and all other conditions // are either list or groups), or if all conditions in an | query have // the same group id as key and "==" as operator + Ox.print('getFindState', find) var conditions, indices, state = {index: -1, key: '*', value: ''}; if (find.operator == '&') { // number of conditions that are not list or groups