new search for app manager and few javascript fixes

This commit is contained in:
Harry Bomrah 2013-04-24 13:48:17 +08:00 committed by Matt K. Fu
parent 1851ebb6f7
commit 5b1f5aa64c
3 changed files with 39 additions and 38 deletions

View File

@ -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 = $("<div style='width:120px; float:left;'></div>");
}
var $newelement = $('<div class="search element w1 h1 hp vp thmc2" data-category="desktop">'+$(this).html()+'</div>');
$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 = $("<div style='width:120px; float:left;'></div>");
// }
// var $newelement = $('<div class="search element w1 h1 hp vp thmc2" data-category="desktop">'+$(this).html()+'</div>');
// $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

View File

@ -3,7 +3,7 @@
<ul class="docklist">
<li class="d_cate"><a callback-method='initializeDesktop' href="desktop/desktop" class="widget_fn wh2 hh2" id='home' onclick="return false;"><span class="widget_icon"><img src="" alt="Home" id="home_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh2 thmc4" style="width: 180px;">
<li class="dock_item"><a callback-method='initializeAppSearch' href="<%= desktop_app_manager_path %>" class="widget_fn wh2 hh2" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeAppManager' href="<%= desktop_app_manager_path %>" class="widget_fn wh2 hh2" id="d_app_manager" onclick="return false;"><span class="widget_icon"><img src="" alt="App Manager" id="app_manager_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSectionsManager' href="<%= desktop_allsections_path %>" class="widget_fn wh2 hh2" id="d_sections" custom-load="sections" onclick="return false;"><span class="widget_icon"><img src="" alt="All Sections" id="sections_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializeSettings' href="<%= desktop_settings_path %>" custom-load="settings" class="widget_fn wh2 hh2" id="d_settings" onclick="return false;"><span class="widget_icon"><img src="" alt="Settings" id="settings_icon" width="30" height="30"/></span></a></li>
</ul>

View File

@ -230,10 +230,6 @@
</script>
<script type="text/javascript">
orbitDesktop.prototype.initializeJournalPapers.conference_title_autocomplete_list = <%= @conference_candidate.to_json.html_safe %>;
// orbitDesktop.prototype.initializeJournalPapers.coauthor_autocomplete_list = <%= @co_author_candidate.to_json.html_safe %>;
</script>
<script>
var get_html = function(old_id,new_id){