diff --git a/app/assets/images/note_success.png b/app/assets/images/note_success.png new file mode 100644 index 00000000..5d5ae2ad Binary files /dev/null and b/app/assets/images/note_success.png differ diff --git a/app/assets/javascripts/desktop.js b/app/assets/javascripts/desktop.js index af5e7b22..c1abfc29 100644 --- a/app/assets/javascripts/desktop.js +++ b/app/assets/javascripts/desktop.js @@ -10,5 +10,4 @@ //= require jquery.tinyscrollbar.min //= require bootstrap //= require orbitdesktopAPI -//= require orbitdesktop -//= require desktopload \ No newline at end of file +//= require orbitdesktop \ No newline at end of file diff --git a/app/assets/javascripts/desktopload.js.erb b/app/assets/javascripts/desktopload.js.erb index e48d13cf..c4e9d1e7 100644 --- a/app/assets/javascripts/desktopload.js.erb +++ b/app/assets/javascripts/desktopload.js.erb @@ -1,5 +1,6 @@ orbitDesktop.prototype.themefolder = "desktop_themes"; orbitDesktopAPI.prototype.notifyImgPath = "/assets/"; +alert("<%= @desktop.inspect %>") var od = new orbitDesktop("#ajax_container"); diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 6495856c..f8823af4 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -13,7 +13,13 @@ var orbitDesktop = function(dom){ this.desktopData = {"home":"","fun":"","work":"","favorite":"","apps_manager":"","sections":""}; this.tp = ""; this.initialize = function(){ - var theme = o.theme; + var theme = o.theme; + $.getJSON("/desktop/get_desktop_settings",{id:o.desktopId},function(desktopSettings){ + if(desktopSettings){ + theme = desktopSettings.theme + } + }) + $.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){ o.themesettings = eval(ts); $('head').append( $('').attr('href', "/"+o.themefolder+"/"+theme+"/css/"+ts.css)); @@ -75,6 +81,15 @@ var orbitDesktop = function(dom){ $("#holder").animate({scrollLeft:0},1000); }*/ }); + var $widget_fn = $('.widget_fn'),$fn_des = $('.fn_des'); + $widget_fn.hover(function(){ + var fn_name = $(this).find('img').attr('alt'),nth = $(this).parents('.d_cate').index(),des_left = $('.dock_child').eq(nth).width(); + $(this).addClass('thmc1'); + $fn_des.text(fn_name).css({'top':nth * 60,'left': des_left + 60}).stop(true, true).fadeIn(); + },function(){ + $(this).removeClass('thmc1'); + $fn_des.stop(true, true).fadeOut(); + }); }; this.initializeDesktop = function(target){ if(!target)target = "desktop"; @@ -134,7 +149,10 @@ var orbitDesktop = function(dom){ } }; this.tempFunc = function(){ - o.notify("This is test notification!!","alert",2) + //o.notify("This is test notification!!","alert",2) + $.post("/desktop/save_desktop_settings",{"theme":$("#change_theme").val()},function(){ + o.notify("Settings Saved!!","success"); + }) } this.initializeAppSearch = function(target){ o.currenthtml = target; @@ -239,43 +257,18 @@ var orbitDesktop = function(dom){ $("div#bgover").css({"position":"fixed","top":"0px","left":"0px","z-index":"-1","width":ww,"height":wh}); }; this.loadIconCache = function(){ - $("#home_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.home); - $("#app_manager_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.app_manager); - $("#sections_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.sections); - $("#settings_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.settings); - $("#publication_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.publication); - $("#journal_p_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.journal_p); - $("#seminar_p_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.seminar_p); - $("#books_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.books); - $("#research_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.research); - $("#research_d_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.research_d); - $("#research_p_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.research_p); - $("#patents_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.patents); - $("#labs_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.labs); - $("#experience_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.experience); - $("#working_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.working); - $("#education_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.education); - $("#honors_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.honors); - $("#activities_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.activities); - $("#clubs_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.clubs); - $("#landt_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.landt); - $("#courses_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.courses); - $("#homework_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.homework); - $("#certification_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.certification); - $("#personal_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.personal); - $("#mypage_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.mypage); - $("#blog_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.blog); - $("#album_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.album); - $("#calendar_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.calendar); - $("#files_icon").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons.files); - $("#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); + var imgs = $("ul.docklist img"); + $.each(imgs,function(){ + var setting_name = $(this).attr("id").replace("_icon",""); + $(this).attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons[setting_name]) + }) } o.initialize(); } orbitDesktop.prototype.themefolder = "themes"; +orbitDesktop.prototype.desktopId = "1"; +orbitDesktop.prototype.notifyImgPath = "temp"; // devin (function(){ @@ -307,4 +300,4 @@ orbitDesktop.prototype.themefolder = "themes"; }); -}()); \ No newline at end of file +}()); diff --git a/app/assets/javascripts/orbitdesktopAPI.js b/app/assets/javascripts/orbitdesktopAPI.js index 282f9dc8..b9594e3b 100644 --- a/app/assets/javascripts/orbitdesktopAPI.js +++ b/app/assets/javascripts/orbitdesktopAPI.js @@ -33,11 +33,9 @@ var orbitDesktopAPI = function(){ img = "note_alert.png"; break; } - $notify.find("img#note_img").attr("src","/assets/"+img); + $notify.find("img#note_img").attr("src",o.notifyImgPath+img); $notify.find(".note_message").text(msg); if(!time)time=5000; else time=time*1000; $notify.slideDown().delay(time).slideUp(); }; -}; - -orbitDesktopAPI.prototype.notifyImgPath = ""; \ No newline at end of file +}; \ No newline at end of file diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 56b4b58b..a7ff8545 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -2,10 +2,11 @@ class DesktopController< ApplicationController layout 'desktop' before_filter :authenticate_user! def index - + @desktop = current_user.desktop end def desktop + render :layout => false end @@ -17,11 +18,15 @@ class DesktopController< ApplicationController render :layout => false end - def save_desktop_theme - + def save_desktop_settings + Desktop.update_attributes(:theme => params["theme"]) + a = Array.new + a << {"success"=>"true"} + render :json=>a.to_json end - def get_desktop_theme - + def get_desktop_settings + @desktop = Desktop.find(params["id"]) + render :json => @desktop.to_json end end \ No newline at end of file diff --git a/app/models/desktop.rb b/app/models/desktop.rb index e88d352b..16c8fd90 100644 --- a/app/models/desktop.rb +++ b/app/models/desktop.rb @@ -10,7 +10,10 @@ class Desktop before_create :initialize_section def initialize_section - user.self.build_section + self.sections.build(name: "Desktop 1") + self.sections.build(name: "Desktop 2") + self.sections.build(name: "Desktop 3") + self.sections.build(name: "Desktop 4") end end \ No newline at end of file diff --git a/app/models/group.rb b/app/models/group.rb index 13668093..4918514d 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -7,7 +7,8 @@ class Group before_create :initialize_tile def initialize_tile - self.build_tile + self.tiles.build + self.tiles.build end end diff --git a/app/models/section.rb b/app/models/section.rb index 7272efcf..f9035c69 100644 --- a/app/models/section.rb +++ b/app/models/section.rb @@ -2,7 +2,7 @@ class Section include Mongoid::Document include Mongoid::Timestamps - field :name, default: "Section" + field :name belongs_to :desktop has_many :groups, :autosave => true, :dependent => :destroy @@ -10,7 +10,8 @@ class Section before_create :initialize_group def initialize_group - self.build_group + self.groups.build + self.groups.build end end \ No newline at end of file diff --git a/app/views/desktop/index.html.erb b/app/views/desktop/index.html.erb index 6f6b43c7..eac389d5 100755 --- a/app/views/desktop/index.html.erb +++ b/app/views/desktop/index.html.erb @@ -80,4 +80,12 @@ Change Theme: