From 5a6541a592c051f0cee86ff14abd0d57748a2fcd Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 11 Apr 2012 17:26:25 +0800 Subject: [PATCH] Setting page update --- app/assets/javascripts/orbitdesktop.js | 118 ++++++++------------ app/controllers/desktop_controller.rb | 5 + app/views/desktop/settings.html.erb | 78 +------------ app/views/desktop/settings/themes.html.erb | 75 +++++++++++++ config/routes.rb | 3 + public/desktop_widgets/clock/index.html.erb | 10 +- 6 files changed, 137 insertions(+), 152 deletions(-) create mode 100644 app/views/desktop/settings/themes.html.erb diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index b95eab3b..aafd5641 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -335,82 +335,58 @@ var orbitDesktop = function(dom){ o.currenthtml = target; o.currentface = "settings"; var bindHandlers = function(){ - $(".theme_list > li").click(function(){ - o.changeTheme($(this).find('.theme_name').text()); - $(".theme_list > li") - .removeClass('thmc1') - .data('clicked',null) - .find('.theme_name') - .removeClass('thmtxt'); - $(this) - .addClass('thmc1') - .data('clicked',true) - .find('.theme_name') - .addClass('thmtxt'); - od.tempFunc($(this).text()); - }); + + } + var loadThemePage = function(){ + var bindHandlers = function(){ + $(".theme_list > li").click(function(){ + o.changeTheme($(this).find('.theme_name').text()); + $(".theme_list > li").removeClass('thmc1').data('clicked',null).find('.theme_name').removeClass('thmtxt'); + $(this).addClass('thmc1').data('clicked',true).find('.theme_name').addClass('thmtxt'); + od.tempFunc($(this).text()); + }); + $('.tinycanvas').each(function(){ + var h = $(this).parent().height(), + sh = $(this).siblings('.s_tab').height(); + $(this).css({'height': h-sh-24}).tinyscrollbar({ axis: 'y'}); + }); - $('.tinycanvas').each(function(){ - var h = $(this).parent().height(), - sh = $(this).siblings('.s_tab').height(); - $(this).css({'height': h-sh-24}).tinyscrollbar({ axis: 'y'}); + var $anchor = $('.s_tab a[href*=#]'), + $tabcontent = $('.st_c'); - }); - - // simple tab navgation - var $anchor = $('.s_tab a[href*=#]'), - $tabcontent = $('.st_c'); - - $anchor.each(function(){ - $(this).click(function(){ - var target = $(this).attr('href'); - - $anchor - .removeClass('thmc2 thmtxt admtxt admbg') - .addClass('admtxt admbg'); - $(this).toggleClass('thmc2 thmtxt admtxt admbg'); - $tabcontent.hide(); - $(target).show(); - $('.tinycanvas').tinyscrollbar_update(); - - return false; - }); - }); - - // simple menu - - // miniColors - $('.color-picker').miniColors({ - - }); - - $('.theme_list li:first-child').data('clicked',true); // this line just for demo - $('.theme_list li').hover(function(){ - $(this) - .addClass('thmc1') - .find('.theme_name') - .addClass('thmtxt'); - }, function(){ - var c = 'thmc1', - t = 'thmtxt'; - if( $(this).data('clicked') ){ - t = '', c = ''; + $anchor.each(function(){ + $(this).click(function(){ + var target = $(this).attr('href'); + $anchor.removeClass('thmc2 thmtxt admtxt admbg').addClass('admtxt admbg'); + $(this).toggleClass('thmc2 thmtxt admtxt admbg'); + $tabcontent.hide(); + $(target).show(); + $('.tinycanvas').tinyscrollbar_update(); + return false; + }); + }); + $('.color-picker').miniColors(); + $('.theme_list li:first-child').data('clicked',true); // this line just for demo + $('.theme_list li').hover(function(){ + $(this).addClass('thmc1').find('.theme_name').addClass('thmtxt'); + }, function(){ + var c = 'thmc1', + t = 'thmtxt'; + if( $(this).data('clicked') ){ + t = '', c = ''; + } + $(this).removeClass(c).find('.theme_name').removeClass(t); + }); + } - $(this) - .removeClass(c) - .find('.theme_name') - .removeClass(t); - }); - + $("div#panel_r").load("/desktop/settingthemes/",function(){ + bindHandlers(); + }) } - $(o.contentHolder).empty().load("/desktop/"+target,function(){ - bindHandlers(); - }); - // }else{ - // $(o.contentHolder).html(o.desktopData[o.currentface]); - // bindHandlers(); - // } + $(o.contentHolder).empty().load("/desktop/"+target,function(){ + loadThemePage(); + }); }; this.loadWallpaper = function(wallpaper){ if(!wallpaper)wallpaper = o.themesettings.background; diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 41b91bf8..4d648467 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -31,10 +31,15 @@ class DesktopController< ApplicationController @desktop = Desktop.find(params["id"]) render :json => @desktop.to_json end + def settings render :layout => false end + def settingthemes + render "desktop/settings/themes", :layout => false + end + def getgroups @section = Section.find(params["sectionid"]) @groups = @section.groups diff --git a/app/views/desktop/settings.html.erb b/app/views/desktop/settings.html.erb index a973ce42..ffc9e313 100644 --- a/app/views/desktop/settings.html.erb +++ b/app/views/desktop/settings.html.erb @@ -12,87 +12,13 @@
  • Overview
  • Account
  • Sections
  • -
  • Theme
  • +
  • Theme
  • Connection
  • - -
    -
    -
    -
    -
    -
      -
    • default
    • -
    • snake
    • -
    • sexy
    • -
    • vintage
    • -
    • natural
    • -
    • chris
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    • Wood
    • -
    -
    -
    -
    Preview
    -
    -
    Theme Text1
    -
    -
    -
    Theme Text2
    -
    -
    Theme Text
    -
    -
    -
    - - - - - - - - - - - - - -
    Theme ColorLine ColorText ColorBackground Color
    - - - - - - - - - - -
    -
    - Confirm -
    -
    -
    -
    -
    -
    -
    +