theme changes

This commit is contained in:
Harry Bomrah 2012-04-06 17:24:39 +08:00
parent 20bfd0d984
commit 625df9094f
2 changed files with 14 additions and 11 deletions

View File

@ -16,16 +16,18 @@ var orbitDesktop = function(dom){
var theme = o.theme;
$.getJSON("/desktop/get_desktop_settings",{id:o.desktopId},function(desktopSettings){
if(desktopSettings){
theme = desktopSettings.theme
}
theme = desktopSettings.theme;
o.theme = theme;
loadTheme();
}else{loadTheme();}
})
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
o.themesettings = eval(ts);
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css));
$(document).ready(function(){o.loadWallpaper();o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
})
var loadTheme = function(){
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
o.themesettings = eval(ts);
$('head').append( $('<link rel="stylesheet" id="dyn_css" type="text/css" />').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css));
$(document).ready(function(){o.loadWallpaper();o.bindDesktopEvents();o.loadIconCache();o.initializeDesktop();});
})
}
};
this.changeTheme = function(theme){
o.theme = theme;
@ -150,7 +152,7 @@ var orbitDesktop = function(dom){
};
this.tempFunc = function(){
//o.notify("This is test notification!!","alert",2)
$.post("/desktop/save_desktop_settings",{"theme":$("#change_theme").val()},function(){
$.post("/desktop/save_desktop_settings",{"id":o.desktopId,"theme":$("#change_theme").val()},function(){
o.notify("Settings Saved!!","success");
})
}

View File

@ -19,7 +19,8 @@ class DesktopController< ApplicationController
end
def save_desktop_settings
Desktop.update_attributes(:theme => params["theme"])
@desktop = Desktop.find(params["id"])
@desktop.update_attributes(:theme => params["theme"])
a = Array.new
a << {"success"=>"true"}
render :json=>a.to_json