From fbea249782351c81154014b38d124c21578a64a5 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Tue, 15 Oct 2013 19:00:38 +0800 Subject: [PATCH] jquery update and also fixed app manager bug .. jquery updated to 1.10.2 and jquery ui updated to 1.10.0 .. gem jquery-rails vs 2.1.4 changed to 3.0.4 and jquery-ui-rails changed to 4.0.5 --- Gemfile | 4 +- app/assets/javascripts/desktop/desktop.js | 2 +- .../javascripts/desktop/orbitdesktop.js | 73 +++++++++---------- app/controllers/desktop_controller.rb | 2 +- ...op.html.erb => desktop_container.html.erb} | 0 app/views/desktop/index.html.erb | 20 ++++- config/routes.rb | 2 +- 7 files changed, 57 insertions(+), 46 deletions(-) rename app/views/desktop/{desktop.html.erb => desktop_container.html.erb} (100%) diff --git a/Gemfile b/Gemfile index 111711ae..933772f0 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,8 @@ gem "net-ldap", "~> 0.3.1" gem 'devise', '1.5.3' gem 'exception_notification' # Send error trace gem 'execjs' -gem 'jquery-rails', '2.1.4' -gem 'jquery-ui-rails' +gem 'jquery-rails', '3.0.4' +gem 'jquery-ui-rails', "4.0.5" gem "select2-rails", '3.3.1' gem 'kaminari' gem 'time_difference' diff --git a/app/assets/javascripts/desktop/desktop.js b/app/assets/javascripts/desktop/desktop.js index 66a8f2c4..fe7c22ab 100644 --- a/app/assets/javascripts/desktop/desktop.js +++ b/app/assets/javascripts/desktop/desktop.js @@ -6,7 +6,7 @@ // //= require jquery //= require jquery_ujs -//= require jquery-ui +//= require jquery.ui.all //= require desktop/jquery.form //= require desktop/jquery.tinyscrollbar //= require desktop/jquery.miniColors.min diff --git a/app/assets/javascripts/desktop/orbitdesktop.js b/app/assets/javascripts/desktop/orbitdesktop.js index a556c263..b364466e 100755 --- a/app/assets/javascripts/desktop/orbitdesktop.js +++ b/app/assets/javascripts/desktop/orbitdesktop.js @@ -168,7 +168,7 @@ var orbitDesktop = function(dom){ o.loadIconCache(); var custom_load = window.location.hash; if(!custom_load){ - $(o.contentHolder).empty().load("/desktop/desktop",function(){ + $(o.contentHolder).empty().load("/desktop/desktop_container",function(){ o.desktopData["d_desktop"] = ""; o.initializeDesktop("d_desktop","",false); }) @@ -605,10 +605,11 @@ var orbitDesktop = function(dom){ this.menu_item = function(dom,customload,submenuitem){ if(!customload)customload=false; - var target = dom.attr("id"); - var url = dom.attr("href"); + var target = dom.attr("id"), + url = dom.attr("href"), + submenu_pass = ( dom.attr("sub-menu") ? true : false); if(!url)return false; - + o.data_method = dom.attr("callback-method"); if(o.currenthtml!=target){ if(o.desktopData[o.currentface] == "undefined"){ @@ -629,33 +630,37 @@ var orbitDesktop = function(dom){ window.o[o.data_method](target,url,cache); } } - try { - if(!customload){ - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); - } else { - if(submenuitem){ - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]")); - } else { + if( submenu_pass ){ + try { + if(!customload){ o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); + } else { + if(submenuitem){ + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]")); + } else { + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data); + } } - } - } catch(EX){} + } catch(EX){} + } header_ani(); }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); - try{ - if(!customload){ - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); - }else{ - if(submenuitem) - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"),o.desktopData[o.currentface]); - else - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); - } - }catch(EX){} + if( submenu_pass ){ + try{ + if(!customload){ + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); + }else{ + if(submenuitem) + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"),o.desktopData[o.currentface]); + else + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),o.desktopData[o.currentface]); + } + }catch(EX){} + } - cache = (o.lastlink == "/desktop/app_manager" ? false : true); + // cache = (o.lastlink == "/desktop/app_manager" ? false : true); if(typeof o.data_method != "undefined"){ if(o.data_method != ""){ window.o[o.data_method](target,url,cache); @@ -1095,7 +1100,7 @@ var orbitDesktop = function(dom){ data : options, success : function(data){ if(data.success == "true"){ - if(dom.is(":checked")){ console.log("true"); + if(dom.is(":checked")){ elementSettingsData[$e.data("id")].sections.push({"id" : dom.data("section"),"name":sectionDetails.name}); o.notify("Added to " + sectionDetails.name,"success"); }else{ @@ -1119,20 +1124,16 @@ var orbitDesktop = function(dom){ var info_open = function(){ if($appinfo.is(":hidden")){ $('.overview').stop().animate({'width': '+=480'},0 , function(){ - $('.tinycanvas').tinyscrollbar_update(); + // $('.tinycanvas').tinyscrollbar_update('relative'); }); $appinfo .css({ - 'display': 'block', 'margin-left': -480 - }) - .delay(300) + }).fadeIn(200) .animate({ 'margin-left': 0 }, 500, 'easeInOutQuint'); - } else { - $('.tinycanvas').tinyscrollbar_update(); - } + } } var info_close = function(){ @@ -1143,13 +1144,11 @@ var orbitDesktop = function(dom){ 'margin-left': -480 },500 , 'easeInOutQuint', function(){ $('.overview').animate({'width': '-=480'}, 0, function(){ - $('.tinycanvas').tinyscrollbar_update(); + // $('.tinycanvas').tinyscrollbar_update(); }); - $(this).attr("style",""); + $(this).fadeOut(300).attr("style",""); }); - } else { - $('.tinycanvas').tinyscrollbar_update(); - } + } } $(window).on('keydown', function(){ if($('#searchbox').val() == 'Search'){ diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 5be83a8a..21c131f9 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -19,7 +19,7 @@ class DesktopController< ApplicationController render :layout => "compatibility" end - def desktop + def desktop_container render :layout => false end diff --git a/app/views/desktop/desktop.html.erb b/app/views/desktop/desktop_container.html.erb similarity index 100% rename from app/views/desktop/desktop.html.erb rename to app/views/desktop/desktop_container.html.erb diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index cd3b6fcd..62f742ec 100644 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -2,7 +2,7 @@
    -
  • Home +
  • Home
    • App Manager
    • Settings
    • @@ -92,10 +92,22 @@ orbitDesktop.prototype.sectionId = "<%= @section.id %>"; orbitDesktop.prototype.currentLanguage = "<%= I18n.locale %>"; orbitDesktop.prototype.currentUsername = "<%= @currentusername %>"; - //uselessfunction(); var od = new orbitDesktop("#ajax_container"); - if($.browser.msie){ - if($.browser.version < 9){ + var getInternetExplorerVersion = function(){ + var rv = -1; // Return value assumes failure. + if (navigator.appName == 'Microsoft Internet Explorer') + { + var ua = navigator.userAgent; + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat( RegExp.$1 ); + } + return rv; + } + + var version = getInternetExplorerVersion(); + if( version != -1){ + if(version < 9){ $.fx.off = true; o.notify("We turn off the animation (javascript) for you, but still you can turn it on",10); } diff --git a/config/routes.rb b/config/routes.rb index 16cad4cf..19eb91ad 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -273,7 +273,7 @@ Orbit::Application.routes.draw do match "/desktop/compatibility" => "desktop#compatibility" match "desktop" => "desktop#index" - match "/desktop/desktop" => "desktop#desktop" + match "/desktop/desktop_container" => "desktop#desktop_container" match '/desktop/appactivation'=>'desktop#appactivation' match '/desktop/app_manager'=>'desktop#app_manager' match '/desktop/allsections'=>'desktop#allsections'