From 6923b822848882ca1a74a678fde4393ab4e04e72 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 4 Jul 2012 19:12:02 +0800 Subject: [PATCH] Added seminar section --- app/assets/javascripts/orbitdesktop.js | 73 ++++++++++++++++++- .../desktop_publications_controller.rb | 12 +++ app/views/desktop/books/seminar.html.erb | 1 - app/views/desktop/seminar_p.html.erb | 33 +++++++++ app/views/desktop/seminar_pages/add.html.erb | 1 + app/views/desktop/seminar_pages/list.html.erb | 1 + app/views/seminar_p.html.erb | 33 +++++++++ config/routes.rb | 4 + 8 files changed, 156 insertions(+), 2 deletions(-) delete mode 100644 app/views/desktop/books/seminar.html.erb create mode 100644 app/views/desktop/seminar_p.html.erb create mode 100644 app/views/desktop/seminar_pages/add.html.erb create mode 100644 app/views/desktop/seminar_pages/list.html.erb create mode 100644 app/views/seminar_p.html.erb diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 087ebfbd..0db73390 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -24,7 +24,7 @@ var orbitDesktop = function(dom){ this.transitionTime = 500; this.currenthtml = "desktop.html"; this.currentface = "home"; - this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":"","orbit":""}; + this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":"","orbit":"","books":"","seminar_p":""}; this.tp = ""; this.sectionList; this.initialize = function(){ @@ -137,6 +137,15 @@ var orbitDesktop = function(dom){ }); } }); + $("a#d_seminar_p").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.initializeSeminar(target); + }); + } + }); $(window).resize(function(){ var ww = $(window).width(); $("img#thmbackground").attr({"width":ww}); @@ -1380,6 +1389,68 @@ var orbitDesktop = function(dom){ bindHandlers(); } } + this.initializeSeminar = function(target){ + o.currenthtml = target; + o.currentface = "seminar_p"; + var bindHandlers = function(){ + $('.s_menu a').on({ + click: function(){ + if(!$(this).hasClass('active')){ + var tfunc = $(this).attr('href'); + switch(tfunc){ + case 'list': + list(); + break; + case 'addseminar': + addseminar(); + break; + } + $('.s_menu a').removeClass('thmc1 thmtxt active'); + $(this).addClass('thmc1 thmtxt active'); + } + }, + mouseenter: function(){ + if(!$(this).hasClass('active')){ + $(this).switchClass('admtxt','thmc1 thmtxt',0); + } + }, + mouseleave: function(){ + var t = $(this).hasClass('active') ? '' : 'thmc1 thmtxt'; + $(this).switchClass(t,'admtxt',0); + } + }); + } + + var list = function(){ + var bindHandlers = function(){ + + } + + $("div#seminar_p div#panel_r").load("/desktop/seminar_p_list",function(){ + bindHandlers(); + }) + } + + var addseminar = function(){ + var bindHandlers = function(){ + + } + + $("div#seminar_p div#panel_r").load("/desktop/seminar_p_add",function(){ + bindHandlers(); + }) + } + if(!o.desktopData[o.currentface]){ + $(o.contentHolder).empty().load("/desktop/"+target,function(){ + list(); + bindHandlers(); + }); + }else{ + $(o.contentHolder).html(o.desktopData[o.currentface]); + list(); + bindHandlers(); + } + } this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper if(!wallpaper)wallpapernm = o.themesettings.background;else wallpapernm = wallpaper var ww = $(window).width(); diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb index f09520a2..74983fca 100644 --- a/app/controllers/desktop_publications_controller.rb +++ b/app/controllers/desktop_publications_controller.rb @@ -23,6 +23,18 @@ class DesktopPublicationsController< ApplicationController render "desktop/books/add", :layout => false end + def seminar_p + render "desktop/seminar_p", :layout => false + end + + def seminar_p_list + render "desktop/seminar_pages/list", :layout => false + end + + def seminar_p_add + render "desktop/seminar_pages/add", :layout => false + end + def create_journal Journal.create(user_id: current_user.id, title: "Ice Cream Sandwich") b = Array.new diff --git a/app/views/desktop/books/seminar.html.erb b/app/views/desktop/books/seminar.html.erb deleted file mode 100644 index cea6c091..00000000 --- a/app/views/desktop/books/seminar.html.erb +++ /dev/null @@ -1 +0,0 @@ -this is seminar page. \ No newline at end of file diff --git a/app/views/desktop/seminar_p.html.erb b/app/views/desktop/seminar_p.html.erb new file mode 100644 index 00000000..8815c90c --- /dev/null +++ b/app/views/desktop/seminar_p.html.erb @@ -0,0 +1,33 @@ +
+
+ +
+ +
+
+
+
+
+
+ \ No newline at end of file diff --git a/app/views/desktop/seminar_pages/add.html.erb b/app/views/desktop/seminar_pages/add.html.erb new file mode 100644 index 00000000..5870f615 --- /dev/null +++ b/app/views/desktop/seminar_pages/add.html.erb @@ -0,0 +1 @@ +This is add page \ No newline at end of file diff --git a/app/views/desktop/seminar_pages/list.html.erb b/app/views/desktop/seminar_pages/list.html.erb new file mode 100644 index 00000000..035d1006 --- /dev/null +++ b/app/views/desktop/seminar_pages/list.html.erb @@ -0,0 +1 @@ +This is list page \ No newline at end of file diff --git a/app/views/seminar_p.html.erb b/app/views/seminar_p.html.erb new file mode 100644 index 00000000..15573365 --- /dev/null +++ b/app/views/seminar_p.html.erb @@ -0,0 +1,33 @@ +
+
+ +
+ +
+
+
+
+
+
+ \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 648fe9b1..0036d813 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -188,6 +188,10 @@ Orbit::Application.routes.draw do match '/desktop/books_list/'=>'desktop_publications#books_list' match '/desktop/books_add/'=>'desktop_publications#books_add' + match '/desktop/seminar_p' => 'desktop_publications#seminar_p' + match '/desktop/seminar_p_list/'=>'desktop_publications#seminar_p_list' + match '/desktop/seminar_p_add/'=>'desktop_publications#seminar_p_add' + match '/desktop/twitter/'=>'otheraccounts#twitter' match '/desktop/forgmail/'=>'otheraccounts#gmail'