From 9478bb13e233ad8d4d9fea82af67be7634109e21 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 24 Apr 2013 14:22:24 +0800 Subject: [PATCH] search fixed again according to devin requirements --- .../Archive/javascripts/orbitdesktop.js | 46 ++++++++++--------- app/views/desktop/app_manager.html.erb | 10 ++-- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app/assets/Archive/javascripts/orbitdesktop.js b/app/assets/Archive/javascripts/orbitdesktop.js index 2d4ef416..e98ab8a1 100755 --- a/app/assets/Archive/javascripts/orbitdesktop.js +++ b/app/assets/Archive/javascripts/orbitdesktop.js @@ -829,31 +829,35 @@ var orbitDesktop = function(dom){ if($(this).val()){ $("#app_manager .search_result").empty(); $("#app_manager #seperator").hide(); - searchArray = $("#app_manager .element:not(:containsi("+$(this).val()+"))"); + $("#app_manager .element").hide("fold","fast"); + + searchArray = $("#app_manager .element:containsi("+$(this).val()+")"); if(searchArray.length > 0){ - searchArray.each(function(){ - $(this).hide("fold","fast"); - }) - // $("#app_manager #seperator").show(); - // var i = 0; - // var $column; // searchArray.each(function(){ - // i++; - // if(i == 1){ - // $column = $("
"); - // } - // var $newelement = $(''); - // $column.append($newelement); - // if(i == 4){ - // $("#app_manager .search_result").append($column); - // i = 0; - // } + // $(this).hide("fold","fast"); // }) - // if(i != 0){ - // $("#app_manager .search_result").append($column); - // } + // $("#app_manager #seperator").show(); + var i = 0; + var $column; + searchArray.each(function(){ + i++; + if(i == 1){ + $column = $("
"); + } + var $newelement = $(''); + $column.append($newelement); + if(i == 4){ + $("#app_manager .search_result").append($column); + i = 0; + } + }) + if(i != 0){ + $("#app_manager .search_result").append($column); + } + }else{ + $("#app_manager .search_result").text("No Result Found."); } - }else{$("#app_manager .element").show("fold","fast");} + }else{ $("#app_manager .search_result").empty(); $("#app_manager .element").show("fold","fast");} }).blur(function(){if($(this).val()=="")$(this).val("Search");}); //for Alphabet sorting diff --git a/app/views/desktop/app_manager.html.erb b/app/views/desktop/app_manager.html.erb index 42bc5011..b40ab963 100644 --- a/app/views/desktop/app_manager.html.erb +++ b/app/views/desktop/app_manager.html.erb @@ -10,13 +10,13 @@
-
- -
+
- - +
+ +
+