From 39e1bc894825be38ca5cd3defbbbc2463e6834fb Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 5 Apr 2012 20:09:01 +0800 Subject: [PATCH] new setting page --- app/assets/javascripts/orbitdesktop.js | 25 +++++++++++++++++++++++-- app/controllers/desktop_controller.rb | 4 ++++ app/views/desktop/settings.html.erb | 1 + config/routes.rb | 1 + 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 app/views/desktop/settings.html.erb diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 3e4e5e6c..a274d055 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -10,7 +10,7 @@ var orbitDesktop = function(dom){ this.transitionTime = 500; this.currenthtml = "desktop.html"; this.currentface = "home"; - this.desktopData = {"home":"","fun":"","work":"","favorite":"","apps_manager":"","sections":""}; + this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":""}; this.tp = ""; this.initialize = function(){ var theme = o.theme; @@ -60,6 +60,15 @@ var orbitDesktop = function(dom){ }); } }); + $("a#d_settings").click(function(){ + var target = $(this).attr("href"); + if(o.currenthtml!=target){ + o.desktopData[o.currentface] = $(o.contentHolder).html(); + $("#content").hide("drop",o.transitionTime,function(){ + o.initializeSectionsManager(target); + }); + } + }); $("select#change_theme").change(function(){ o.changeTheme($(this).val()); }) @@ -188,7 +197,7 @@ var orbitDesktop = function(dom){ }; this.initializeSectionsManager = function(target){ o.currenthtml = target; - o.currentface = "settings"; + o.currentface = "sections"; var elementParent,element; var bindHandlers = function(){ $(".group").width(530); @@ -271,6 +280,18 @@ var orbitDesktop = function(dom){ $("#orbit_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.orbit); $("#connection_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.connection); $("#appstore_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.appstore); + }; + this.initializeSettings = function(target){ + o.currenthtml = target; + o.currentface = "sections"; + if(!o.desktopData[o.currentface]){ + $(o.contentHolder).empty().load("/desktop/"+target,function(){ + // bindHandlers(); + }); + }else{ + $(o.contentHolder).html(o.desktopData[o.currentface]); + // bindHandlers(); + } } o.initialize(); } diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index a8dfb275..9d9211bc 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -16,4 +16,8 @@ class DesktopController< ApplicationController def sections render :layout => false end + + def settings + render :layout => false + end end \ No newline at end of file diff --git a/app/views/desktop/settings.html.erb b/app/views/desktop/settings.html.erb new file mode 100644 index 00000000..fe5dd4a2 --- /dev/null +++ b/app/views/desktop/settings.html.erb @@ -0,0 +1 @@ +settings \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 913de734..ddeafd25 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -98,6 +98,7 @@ Orbit::Application.routes.draw do match '/desktop/desktop'=>'desktop#desktop' match '/desktop/app_manager'=>'desktop#app_manager' match '/desktop/sections'=>'desktop#sections' + match '/desktop/settings'=>'desktop#settings' match '/panel/:app_name/front_end/:app_action/:id' => 'pages#show_from_link', :constraints => lambda { |request| !request.query_string.include?("inner=true") }