From 670ec2a40ece218631823cbf0df017e388bdd550 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 23 Apr 2012 21:04:02 +0800 Subject: [PATCH] Themes from db fixed.. --- app/assets/javascripts/orbitdesktop.js | 9 ++++----- app/controllers/desktop_controller.rb | 2 +- app/models/{theme.rb => desktop_theme.rb} | 3 +-- app/views/desktop/settings/sections.html.erb | 2 +- app/views/desktop/settings/themes.html.erb | 11 +++++------ 5 files changed, 12 insertions(+), 15 deletions(-) rename app/models/{theme.rb => desktop_theme.rb} (74%) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 5a0d79fc..dc431a55 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -178,9 +178,7 @@ var orbitDesktop = function(dom){ }) newpostitions.push(groupone); }); - $.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids},function(){ - - }) + $.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids}) } } }); @@ -268,7 +266,7 @@ var orbitDesktop = function(dom){ $("div#desktop ul#section_list").empty(); $.each(o.sectionList,function(i,section){ var tempstyle=""; - if(i==0){ + if(section._id==o.sectionId){ tempstyle = "style='display:none;'"; $("div#desktop span#section_heading").text(section.name); } @@ -507,8 +505,9 @@ var orbitDesktop = function(dom){ }) $.post("/desktop/save_desktop_settings",{"save":"desktopnames","desktopid":o.desktopId,"desktopnms":desktopnm},function(result,status){ if(status=="success"){ - if(result[0].success=="true") + if(result[0].success=="true"){ o.notify("Names Saved!!","success",2); + } else o.notify("Name saving failed!!","imp",2); }else{ diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 249f9dca..70694331 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -27,7 +27,7 @@ class DesktopController< ApplicationController end def settingthemes - # @themes = Theme.count + @themes = DesktopTheme.all # raise @themes.inspect render "desktop/settings/themes", :layout => false end diff --git a/app/models/theme.rb b/app/models/desktop_theme.rb similarity index 74% rename from app/models/theme.rb rename to app/models/desktop_theme.rb index 53584bee..76886103 100644 --- a/app/models/theme.rb +++ b/app/models/desktop_theme.rb @@ -1,10 +1,9 @@ -class Theme +class DesktopTheme include Mongoid::Document include Mongoid::Timestamps field :name field :author - embedded_in :desktop end diff --git a/app/views/desktop/settings/sections.html.erb b/app/views/desktop/settings/sections.html.erb index 6b1d73e3..32db370b 100644 --- a/app/views/desktop/settings/sections.html.erb +++ b/app/views/desktop/settings/sections.html.erb @@ -3,7 +3,7 @@
-
Sections Name
+
Section Names
  • diff --git a/app/views/desktop/settings/themes.html.erb b/app/views/desktop/settings/themes.html.erb index 803079da..6a3c34f8 100644 --- a/app/views/desktop/settings/themes.html.erb +++ b/app/views/desktop/settings/themes.html.erb @@ -11,14 +11,13 @@
    -
    Default
    -
    Snake
    -
    Sexy
    -
    Vintage
    -
    Natural
    -
    Chris
    + <% @themes.each do |theme| %> +
    <%= theme.name %>
    + <% end %>
    + +
    Preview