From 7151102a861b580382961e6af5d2fa1161c1bcec Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 28 Jun 2012 17:31:48 +0800 Subject: [PATCH] new page add and timeline changes --- app/assets/javascripts/orbitTimeline.js | 14 +++++++++++--- app/assets/javascripts/orbitdesktop.js | 17 +++++++++++++---- app/controllers/desktop_appstore_controller.rb | 4 ++++ .../desktop_publications_controller.rb | 10 +++++++++- app/models/paper.rb | 1 + app/views/desktop/appstore.html.erb | 2 +- app/views/desktop/appstore/onlinestore.html.erb | 11 +++++++++++ config/routes.rb | 4 +++- 8 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 app/views/desktop/appstore/onlinestore.html.erb diff --git a/app/assets/javascripts/orbitTimeline.js b/app/assets/javascripts/orbitTimeline.js index 0fc48c78..5eecb48c 100644 --- a/app/assets/javascripts/orbitTimeline.js +++ b/app/assets/javascripts/orbitTimeline.js @@ -14,11 +14,17 @@ var orbitTimeline = function(dom){ t.dom.html(t.timelineHtml); $("div.scrollbar").hide(); t.constructTimeScale(function(timelineScale){ + console.log(timelineScale); $("#timeline_scale").html(timelineScale); + var totalyearwidth =timelineScale.find(".year").length * 100; + var totalul = 0; for(eve in t.events){ - t.makeBubble(t.events[eve]); + totalul = $("#scale_wrapper ul").length + $(".t_scale").width((totalul*350) + totalyearwidth); } + + $('.tinycanvas').tinyscrollbar({ axis: 'x'}); }); } this.constructTimeScale = function(callbackFn){ @@ -31,7 +37,8 @@ var orbitTimeline = function(dom){ var cur_mon = paper.created_at.substr(5,2); var cur_year = dt.getFullYear(); var cdt = paper.created_at.substr(0,7).replace("-",""); - var bubbleData = {"fulldate" : t.monthList[parseInt(cur_mon)] +", " + dt.getDate() + ", " + cur_year,"title":paper.title,"jtitle":journal.title,"coauthors":paper.coauthors,"abstract":paper.abstract,"timestamp":cdt} + var formname = (cur_mon.charAt(0) == "0"?cur_mon.charAt(1) : cur_mon) + var bubbleData = {"fulldate" : t.monthList[parseInt(formname)] +", " + dt.getDate() + ", " + cur_year,"title":paper.title,"jtitle":journal.title,"coauthors":paper.coauthors,"abstract":paper.abstract,"timestamp":cdt} t.events.push(bubbleData); if(cur_year != year){ year = cur_year; @@ -39,7 +46,8 @@ var orbitTimeline = function(dom){ } if(cur_mon != mon){ mon = cur_mon; - scale.append($("
"+t.monthList[parseInt(mon)]+"
")) + console.log(parseInt(cur_mon)); + scale.append($("
"+t.monthList[parseInt(formname)]+"
")) } }); }) diff --git a/app/assets/javascripts/orbitdesktop.js b/app/assets/javascripts/orbitdesktop.js index 31f80074..cd437550 100755 --- a/app/assets/javascripts/orbitdesktop.js +++ b/app/assets/javascripts/orbitdesktop.js @@ -907,7 +907,6 @@ var orbitDesktop = function(dom){ var bindHandlers = function(){ var timeline = new orbitTimeline("timeline"); timeline.initialize(); - $('.tinycanvas').tinyscrollbar({ axis: 'x'}); } if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop_orbit/"+target,function(){ @@ -1143,7 +1142,10 @@ var orbitDesktop = function(dom){ switch(tfunc){ case 'widgets': widgets(); - break; + break; + case 'onlinestore': + onlinestore(); + break; } $('.s_menu a').removeClass('thmc1 thmtxt active'); $(this).addClass('thmc1 thmtxt active'); @@ -1288,15 +1290,22 @@ var orbitDesktop = function(dom){ }) }) } + var onlinestore = function(){ + var bindHandlers = function(){ + } + $("div#apps_store div#panel_r").load("/desktop_appstore/onlinestore",function(){ + bindHandlers(); + }) + } if(!o.desktopData[o.currentface]){ $(o.contentHolder).empty().load("/desktop_appstore/"+target,function(){ - widgets(); + onlinestore(); bindHandlers(); }); }else{ $(o.contentHolder).html(o.desktopData[o.currentface]); - widgets(); + onlinestore(); bindHandlers(); } } diff --git a/app/controllers/desktop_appstore_controller.rb b/app/controllers/desktop_appstore_controller.rb index d05160c2..05701891 100644 --- a/app/controllers/desktop_appstore_controller.rb +++ b/app/controllers/desktop_appstore_controller.rb @@ -8,6 +8,10 @@ class DesktopAppstoreController< ApplicationController render "desktop/appstore/widgets", :layout => false end + def onlinestore + render "desktop/appstore/onlinestore", :layout => false + end + def getuserwidgets @widgets = current_user.desktop.desktop_widgets @groups = Array.new diff --git a/app/controllers/desktop_publications_controller.rb b/app/controllers/desktop_publications_controller.rb index 4f30ebde..8e3d3a5f 100644 --- a/app/controllers/desktop_publications_controller.rb +++ b/app/controllers/desktop_publications_controller.rb @@ -12,7 +12,7 @@ class DesktopPublicationsController< ApplicationController end def create_journal - Journal.create(user_id: current_user.id, title: "2012, Javascript") + Journal.create(user_id: current_user.id, title: "Google") b = Array.new b << {"success"=>"true"} render :json=>b.to_json @@ -27,4 +27,12 @@ class DesktopPublicationsController< ApplicationController end render :json=>data.to_json end + + def delete_journal + @journals = Journal.find("") + @journals.delete + b = Array.new + b << {"success"=>"true"} + render :json=>b.to_json + end end diff --git a/app/models/paper.rb b/app/models/paper.rb index 5e248a1d..b085aaa7 100644 --- a/app/models/paper.rb +++ b/app/models/paper.rb @@ -7,6 +7,7 @@ class Paper field :abstract, default: "The concept of microstructure engineering has gained increasingly attention with the goal to quantitatively link the operational parameters of an industrial process to the properties of its product. The key component of this concept is to accurately model the microstructure evolution along the processing path. Modelling of recrystallization in Cuinterconnects will be presented as an example of a conventional process model. Further, the potential of developing next generation process models will be discussed by using models across different length and time scale. The multi-scale modelling approach will be illustrated with a case study for phase transformation in Fe-Mn alloys." field :level, default: "SCI" field :coauthors, default: "Allen, Shelly, Eric, Manson, Chris, Clara, Anna, Albee, Vincent, Devin, Chunchi, Ika, Jaoshua, Ray, Matt, Lin, Spen" + field :created_at, type: Date, default: ->{12.months.ago} belongs_to :journal diff --git a/app/views/desktop/appstore.html.erb b/app/views/desktop/appstore.html.erb index c92ac427..ab83d9d9 100644 --- a/app/views/desktop/appstore.html.erb +++ b/app/views/desktop/appstore.html.erb @@ -10,7 +10,7 @@
    -
  • Online Store
  • +
  • Online Store
  • Widgets
  • Apps
  • Registeration
  • diff --git a/app/views/desktop/appstore/onlinestore.html.erb b/app/views/desktop/appstore/onlinestore.html.erb new file mode 100644 index 00000000..4b7ae56a --- /dev/null +++ b/app/views/desktop/appstore/onlinestore.html.erb @@ -0,0 +1,11 @@ +
    Online Store
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 850e3fa6..2a38c8ea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -164,13 +164,15 @@ Orbit::Application.routes.draw do match '/desktop_appstore/appstore'=>'desktop_appstore#appstore' match '/desktop_appstore/widgets'=>'desktop_appstore#widgets' + match '/desktop_appstore/onlinestore'=>'desktop_appstore#onlinestore' match '/desktop_appstore/getuserwidgets'=>'desktop_appstore#getuserwidgets' match '/desktop_appstore/widgets_settings'=>'desktop_appstore#widgets_settings' match '/desktop_orbit/orbit' => 'desktop_orbit#orbit' match '/desktop_orbit/getevents' => 'desktop_orbit#getevents' #match '/desktop_orbit/getevents' => 'desktop_publications#create_journal' - + #match '/desktop_orbit/getevents' => 'desktop_publications#delete_journal' + match '/desktop/temp_func/'=>'desktop#temp_func' match '/panel/:app_name/front_end/:app_action/:id' => 'pages#show_from_link', :constraints => lambda { |request|