From 2f67a9653223ebeea3e4ffcfe8b34946bf32a92e Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 28 Nov 2012 18:11:49 +0800 Subject: [PATCH] url fixed and edit form fixed for tinyscrollbar --- .../javascripts/desktop/journal_pages.js.erb | 4 + app/assets/javascripts/orbitdesktop.js | 109 ++++++++++++------ app/views/desktop/index.html.erb | 4 +- app/views/desktop/journal_p.html.erb | 2 +- app/views/desktop/settings.html.erb | 4 +- app/views/devise/registrations/edit.html.erb | 9 +- 6 files changed, 88 insertions(+), 44 deletions(-) diff --git a/app/assets/javascripts/desktop/journal_pages.js.erb b/app/assets/javascripts/desktop/journal_pages.js.erb index f2cdab80f..44d3bc9c4 100644 --- a/app/assets/javascripts/desktop/journal_pages.js.erb +++ b/app/assets/javascripts/desktop/journal_pages.js.erb @@ -57,6 +57,10 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // success : function(data){ var prev_data = $("div[container=true]").html(); $("div[container=true]").html(data); + o.tinyscrollbar_ext({ + main: '.tinycanvas', + fill: '.s_grid_con' + }) $(".bt-cancel").click(function(){ $("div[container=true]").html(prev_data); }) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index a37154d9f..f66eacb4e 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -65,15 +65,28 @@ var orbitDesktop = function(dom){ o.loadWallpaper(customwallpaper); o.bindDesktopEvents(); o.loadIconCache(); - - $(o.contentHolder).empty().load("/desktop/desktop",function(){ - o.desktopData["d_desktop"] = ""; - o.initializeDesktop("d_desktop","",false); - }) + var custom_load = window.location.hash; + if(!custom_load){ + $(o.contentHolder).empty().load("/desktop/desktop",function(){ + o.desktopData["d_desktop"] = ""; + o.initializeDesktop("d_desktop","",false); + }) + }else{ + o.customPage(custom_load); + } }); }) } } + this.customPage = function(customload){ + customload = customload.replace("#",""); + if(customload.search("-") != -1){ + customload = customload.split("-"); + o.menu_item($(".docklist a[custom-load="+customload[0]+"]"),true,customload[1]); + }else{ + o.menu_item($(".docklist a[custom-load="+customload+"]"),true); + } + } this.changeTheme = function(theme){ // this function is used for changing theme o.theme = theme; $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ @@ -84,38 +97,10 @@ var orbitDesktop = function(dom){ o.loadIconCache(); }) }; + this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc $(".docklist a").click(function(){ - var target = $(this).attr("id"); - var url = $(this).attr("href"); - o.data_method = $(this).attr("callback-method"); - if(o.currenthtml!=target){ - if(o.desktopData[o.currentface] == "undefined") - o.desktopData[o.currentface] = ""; - o.desktopData[o.currentface] = $(o.contentHolder).html(); - $("#content").hide("drop",o.transitionTime,function(){ - o.currenthtml = target; - o.currentface = target; - var cache = false; - if(!o.desktopData[o.currentface]){ - $(o.contentHolder).empty().load(url,function(){ - if(typeof o.data_method != "undefined"){ - if(o.data_method != "") - window.o[o.data_method](target,url,cache); - } - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]")); - }) - }else{ - $(o.contentHolder).html(o.desktopData[o.currentface]); - o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]")); - cache = true; - if(typeof o.data_method != "undefined"){ - if(o.data_method != "") - window.o[o.data_method](target,url,cache); - } - } - }); - } + o.menu_item($(this)); return false; }) @@ -223,6 +208,58 @@ 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"); + o.data_method = dom.attr("callback-method"); + if(o.currenthtml!=target){ + if(o.desktopData[o.currentface] == "undefined") + o.desktopData[o.currentface] = ""; + o.desktopData[o.currentface] = $(o.contentHolder).html(); + if(customload){ + $(o.contentHolder).html("
"); + } + $("#content").hide("drop",o.transitionTime,function(){ + o.currenthtml = target; + o.currentface = target; + + var cache = false; + if(!o.desktopData[o.currentface]){ + $(o.contentHolder).empty().load(url,function(){ + if(typeof o.data_method != "undefined"){ + if(o.data_method != "") + window.o[o.data_method](target,url,cache); + } + if(!customload) + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]")); + 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]")); + } + + }) + }else{ + $(o.contentHolder).html(o.desktopData[o.currentface]); + if(!customload) + o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]")); + 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]")); + } + cache = true; + if(typeof o.data_method != "undefined"){ + if(o.data_method != "") + window.o[o.data_method](target,url,cache); + } + } + }); + } + } this.sub_menu_item = function(dom){ if(!dom.hasClass('active')){ var sub_data_method = dom.attr('callback-method'); @@ -623,6 +660,8 @@ var orbitDesktop = function(dom){ }; this.initializeSettings = function(target,url,cache){ //this is to initialize setting page + this.initializeSettings.account = function(){} + this.initializeSettings.sections = function(){ // this load section page in setting page var bindHandlers = function(){ // binding handlers in section page $('.tinycanvas').each(function(){ diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index b3f78780e..c90f53fdd 100755 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -5,13 +5,13 @@
  • Publication