From 5b1f5aa64c1dafeea25c18705190b3172dcfd0e6 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 24 Apr 2013 13:48:17 +0800 Subject: [PATCH] new search for app manager and few javascript fixes --- app/assets/javascripts/orbitdesktop.js | 71 ++++++++++--------- app/views/desktop/index.html.erb | 2 +- .../desktop/conference_pages/_form.html.erb | 4 -- 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 7be19d5ae..2d4ef416b 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -638,18 +638,6 @@ var orbitDesktop = function(dom){ // $('*[content-type=menu] a').removeClass('thmc1 thmtxt active'); // dom.addClass('thmc1 thmtxt active'); } - this.highlight_sub_menu_item = function(no){ - $('*[content-type=menu] a').removeClass('thmc1 thmtxt active'); - var dom; - if(typeof no == "number"){ - dom = $('*[content-type=menu] a').eq(no); - dom.addClass('thmc1 thmtxt active'); - }else if(typeof no == "object"){ - dom = no; - dom.addClass('thmc1 thmtxt active'); - } - return dom; - } this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles target = (!target) ? 'desktop' : target; @@ -829,7 +817,7 @@ var orbitDesktop = function(dom){ $.post("desktop/twitter",function(){}); }; - this.initializeAppSearch = function(target,url,cache){ //this is application search ie is app manager initialization + this.initializeAppManager = function(target,url,cache){ //this is application search ie is app manager initialization var searchArray,allApps; var bindHandlers = function(){ // bind handler for app manager page var gn = $('.g_col').length, @@ -841,29 +829,32 @@ var orbitDesktop = function(dom){ if($(this).val()){ $("#app_manager .search_result").empty(); $("#app_manager #seperator").hide(); - searchArray = $("#app_manager .element:containsi("+$(this).val()+")"); - if(searchArray.length>0){ - $("#app_manager #seperator").show(); - var i = 0; - var $column; + searchArray = $("#app_manager .element:not(:containsi("+$(this).val()+"))"); + if(searchArray.length > 0){ 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 #seperator").hide();$("#app_manager .search_result").empty();} - }).blur(function(){$(this).val("Search");}); + }else{$("#app_manager .element").show("fold","fast");} + }).blur(function(){if($(this).val()=="")$(this).val("Search");}); //for Alphabet sorting $("#app_manager #alphabet_sort_btn").click(function(){ @@ -1602,6 +1593,20 @@ var orbitDesktop = function(dom){ }); }); } + + this.highlight_sub_menu_item = function(no){ + $('*[content-type=menu] a').removeClass('thmc1 thmtxt active'); + var dom; + if(typeof no == "number"){ + dom = $('*[content-type=menu] a').eq(no); + dom.addClass('thmc1 thmtxt active'); + }else if(typeof no == "object"){ + dom = no; + dom.addClass('thmc1 thmtxt active'); + } + return dom; + } + this.use_select2 = function(){ $('select:not(.select2-offscreen)').select2({ minimumResultsForSearch: -1 diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index 071648ae8..25ddf6089 100644 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -3,7 +3,7 @@