Timeline commit

This commit is contained in:
Harry Bomrah 2012-06-26 15:59:28 +08:00
parent 7f0267aedd
commit 555ec86403
14 changed files with 306 additions and 57 deletions

View File

@ -22,7 +22,7 @@ gem 'rake'
gem 'ruby-debug19'
gem 'rubyzip'
gem 'sinatra'
gem 'sinatra-contrib'
#gem 'sinatra-contrib'
gem 'sprockets'
gem 'tinymce-rails'
gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux")

View File

@ -40,7 +40,6 @@ GEM
multi_json (~> 1.0)
archive-tar-minitar (0.5.2)
arel (2.2.3)
backports (2.5.3)
bcrypt-ruby (3.0.1)
bcrypt-ruby (3.0.1-x86-mingw32)
brakeman (1.5.1)
@ -80,7 +79,6 @@ GEM
diff-lcs (1.1.3)
encrypted_strings (0.3.3)
erubis (2.7.0)
eventmachine (0.12.10)
exception_notification (2.5.2)
actionmailer (>= 3.0.4)
execjs (1.3.0)
@ -208,13 +206,6 @@ GEM
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
sinatra-contrib (1.3.1)
backports (>= 2.0)
eventmachine
rack-protection
rack-test
sinatra (~> 1.3.0)
tilt (~> 1.3)
spork (0.9.0)
spork (0.9.0-x86-mingw32)
win32-process
@ -282,10 +273,8 @@ DEPENDENCIES
shoulda-matchers
simplecov
sinatra
sinatra-contrib
spork
sprockets
tinymce-rails
uglifier
warden
watchr

View File

@ -11,4 +11,5 @@
//= require jquery.miniColors.min
//= require bootstrap
//= require orbitdesktopAPI
//= require orbitTimeline
//= require orbitdesktop

View File

@ -0,0 +1,71 @@
//for timeline parent library, will be accessable by main library and API library for other people to use.. default inherits orbitDesktopAPI
// Harry Bomrah
var orbitTimeline = function(dom){
t = this;
this.dom = $("#"+dom);
this.timelineHtml = $("<div class='t_bottom t_scale' id='timeline_scale'></div>");
//this.marker = t.timelineHtml.find("#timline_marker");
this.scale = t.timelineHtml.find("#timeline_scale");
//this.container = t.timelineHtml.find("#t_container");
this.initialize = function(){
t.dom.html(t.timelineHtml);
$("div.scrollbar").hide();
//var cursor = t.marker.draggable({containment:"parent","option":"cursorAt"});
var timelineScale = t.constructTimeScale();
$("#timeline_scale").html(timelineScale);
t.makeBubble("012012");
t.makeBubble("012012");
$("#test_bubble").click(function(){
t.makeBubble("062012");
})
}
this.constructTimeScale = function(){
//$.getJSON("test.json",function(){
var scale = $("<div id='scale_wrapper'></div>");
scale.append($("<div class='scale_region year'>2013</div><div class='scale_region month' data-content='012012'><div class='month_heading'>January</div><div class='bubble_list'></div></div><div class='scale_region month' data-content='062012'><div class='month_heading'>June</div><div class='bubble_list'></div></div><div class='scale_region year'>2012</div>"));
scale.find(".scale_region").each(function(){
var verticalchars = "";
var txt = $(this).text();
var margin = ($(this).width()-20)/2;
// for(c in txt){
// if($(this).hasClass('month')){
// verticalchars+="<span style='padding-left:"+margin+"px'>"+txt.charAt(c)+"</span>";
// }else
// verticalchars+="<span style='padding-left:5px'>"+txt.charAt(c)+"</span>";
// }
//$(this).html(verticalchars);
})
return scale;
//})
}
this.makeBubble = function(timestamp){
var totalul = $("#scale_wrapper").find("div[data-content="+timestamp+"] ul").length;
var targetul = $("#scale_wrapper div[data-content="+timestamp+"] div.bubble_list ul").eq(totalul-1);
if(totalul == 0){
var ul = $("<ul></ul>");
$("#scale_wrapper").find("div[data-content="+timestamp+"] div.bubble_list").append(ul);
targetul = ul;
}else{
var totalli = targetul.find("li").length;
if(totalli >= 5){
var ul = $("<ul></ul>");
$("#scale_wrapper").find("div[data-content="+timestamp+"] div.bubble_list").append(ul);
targetul = ul;
}
}
var bubble = $("<li class='bubble'>This is test bubble.</li>");
bubble.css("margin-left","25px");
targetul.prepend(bubble);
bubble.show("bounce",{},500);
bubble.click(function(){
o.toolPopup({
parent: $(this),
html : "<div><b><u>"+timestamp+"</u></b></div>",
height: "auto",
width:"300px"
});
})//.mouseout(function(){t.oapi.toolPopup("destroy");})
}
}

View File

@ -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":""};
this.desktopData = {"home":"","settings":"","work":"","favorite":"","apps_manager":"","sections":"","journal_p":"","appstore":"","orbit":""};
this.tp = "";
this.sectionList;
this.initialize = function(){
@ -112,6 +112,9 @@ var orbitDesktop = function(dom){
});
$("a#d_appstore").click(function(){
var target = $(this).attr("href");
console.log(o.currenthtml);
console.log(target);
console.log(o.currentface);
if(o.currenthtml!=target){
o.desktopData[o.currentface] = $(o.contentHolder).html();
$("#content").hide("drop",o.transitionTime,function(){
@ -119,6 +122,15 @@ var orbitDesktop = function(dom){
});
}
});
$("a#d_orbit").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.initializeOrbitTimeline(target);
});
}
});
$(window).resize(function(){
var ww = $(window).width();
$("img#thmbackground").attr({"width":ww});
@ -892,7 +904,24 @@ var orbitDesktop = function(dom){
themes();
});
};
this.initializeOrbitTimeline = function(target){
o.currenthtml = target;
o.currentface = "orbit";
console.log(o.currentface);
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(){
bindHandlers();
});
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
bindHandlers();
}
};
this.initializeJournalPapers = function(target){ // this init journal papers
o.currenthtml = target;
o.currentface = "journal_p";

View File

@ -158,6 +158,40 @@ var orbitDesktopAPI = function(){
callbackfn.call(this);
}
};
this.toolPopup = function(settings){
if(settings == "destroy"){
$(".desktop_toolpopup").hide("fold",function(){
$(this).remove();
$(this).parent().css("position","");
})
return;
}
if(settings.parent){
if(settings.parent.find("div.desktop_toolpopup").length == 0){
settings.height = (!settings.height ? "50px" : settings.height);
settings.width = (!settings.width ? "150px" : settings.width);
settings.html = (!settings.html ? "" : settings.html);
var leftpos = settings.parent.width();
var toolpopup = $("<div class='desktop_toolpopup thmc1' style='height:"+settings.height+";width:"+settings.width+"; left:"+leftpos+"px;'><span>"+settings.html+"</span></div>");
settings.parent.css("position","relative");
settings.parent.prepend(toolpopup);
toolpopup.click(function(event){
event.stopPropagation();
});
toolpopup.show("fold",function(){
$(document).unbind("click");
$(document).one("click",function(e){
toolpopup.hide("fold",function(){
toolpopup.remove();
settings.parent.css("position","");
});
})
});
}
}
}
};
orbitDesktopAPI.prototype.notifyImgPath = "temp";
orbitDesktopAPI.prototype.wallpaperPath = "temp";

View File

@ -9,4 +9,5 @@
*= require font-awesome
*= require desktopmain
*= require desktopmedia
*= require orbitTimeline
*/

View File

@ -715,3 +715,15 @@ a:focus { outline: none; }
font-size: 20px;
cursor: pointer;
}
/*Tooltip popup */
.desktop_toolpopup{
position: absolute;
z-index:10px;
display: none;
border-width:3px;
border-radius:5px;
border-color:black;
font-size:15px;
padding: 5px 0px 10px 0px;
cursor: default;
}

View File

@ -0,0 +1,66 @@
.t_scale{
width:2000px;
height:516px;
bottom:0;
}
#timline_marker{
width:100px;
height:140px;
opacity:0.4;
cursor: move;
border-style:solid;
border-width:5px;
border-radius:5px;
}
.t_scale{
border-style:solid;
border-width:2px;
border-radius:5px;
}
#t_container{
height:366px;
}
.scale_region{
height:516px;
border-style:solid;
border-width:0 2px 0 2px;
float: left;
margin-right:1px;
font-size:20px;
padding:5px;
}
.scale_region span{
display: block;
}
.month{
}
.year{
background-color: #c0bebe;
width:30px;
}
.bubble{
cursor: pointer;
width:300px;
height:30px;
background:lightblue;
border-style:solid;
border-width:5px;
float: left;
border-radius:5px;
margin-top: 10px;
margin-bottom:10px;
font-size:20px;
padding:5px;
text-align:center;
display: none;
}
.month_heading{
text-align: center;
margin-bottom: 10px;
}
.bubble_list ul{
width:350px;
float:left;
}

View File

@ -0,0 +1,7 @@
class DesktopOrbitController< ApplicationController
def orbit
render "desktop/orbit", :layout => false
end
end

View File

@ -48,7 +48,7 @@
<li class="dock_item"><a href="files" class="widget_fn wh3 hh3" id='d_files' onclick="return false;"><span class="widget_icon"><img src="" alt="Files" id="files_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a href="" class="widget_fn wh3 hh3" id='d_orbit' onclick="return false;"><span class="widget_icon"><img src="" alt="Orbit" id="orbit_icon" width="30" height="30"/></span></a>
<li class="d_cate"><a href="orbit" class="widget_fn wh3 hh3" id='d_orbit' onclick="return false;"><span class="widget_icon"><img src="" alt="Orbit" id="orbit_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh3 thmc4" style="width: 60px;">
<li class="dock_item"><a href="connection" class="widget_fn wh3 hh3" id='d_connection' onclick="return false;"><span class="widget_icon"><img src="" alt="Academia Connection" id="connection_icon" width="30" height="30"/></span></a></li>
</ul>

View File

@ -0,0 +1,25 @@
<div id="orbit">
<div id="content">
<div id="header" class="hh3">
<div class="dtitle w2 hh3 hp">
<span class="thmtxth">TimeLine</span>
</div>
</div>
<div id="holder">
<div id="panel_r" class="ph pw admbg hp" style="margin-left:0px; padding:0px;">
<div class="tinycanvas">
<div class="scrollbar sb_h vp"><div class="track"><div class="thumb thmc2"><div class="end"></div></div></div></div>
<div class="viewport">
<div id="timeline" class="overview">
</div>
</div>
</div>
<button id="test_bubble" style="z-index:10px; postion:absolute;">Add bubble</button>
</div>
<div class="clear"></div>
</div>
</div>
</div>

View File

@ -106,66 +106,68 @@ Orbit::Application.routes.draw do
# Sinatra Routes start
match '/desktop/desktop', :to => Desktopapp::DesktopApp
match '/desktop/app_manager', :to => Desktopapp::DesktopApp
match '/desktop/sections', :to => Desktopapp::DesktopApp
match '/desktop/settings', :to => Desktopapp::DesktopApp
match '/desktop/get_desktop_settings/', :to => Desktopapp::DesktopApp
match '/desktop/save_desktop_settings/', :to => Desktopapp::DesktopApp
match '/desktop/getgroups/', :to => Desktopapp::DesktopApp
match '/desktop/getsectionlist/', :to => Desktopapp::DesktopApp
match '/desktop/settingthemes/', :to => Desktopapp::DesktopApp
match '/desktop/settingsections/', :to => Desktopapp::DesktopApp
match '/desktop/getapplist/', :to => Desktopapp::DesktopApp
match '/desktop/newpositions/', :to => Desktopapp::DesktopApp
match '/desktop/settingconnection/', :to => Desktopapp::DesktopApp
# match '/desktop/desktop', :to => Desktopapp::DesktopApp
# match '/desktop/app_manager', :to => Desktopapp::DesktopApp
# match '/desktop/sections', :to => Desktopapp::DesktopApp
# match '/desktop/settings', :to => Desktopapp::DesktopApp
# match '/desktop/get_desktop_settings/', :to => Desktopapp::DesktopApp
# match '/desktop/save_desktop_settings/', :to => Desktopapp::DesktopApp
# match '/desktop/getgroups/', :to => Desktopapp::DesktopApp
# match '/desktop/getsectionlist/', :to => Desktopapp::DesktopApp
# match '/desktop/settingthemes/', :to => Desktopapp::DesktopApp
# match '/desktop/settingsections/', :to => Desktopapp::DesktopApp
# match '/desktop/getapplist/', :to => Desktopapp::DesktopApp
# match '/desktop/newpositions/', :to => Desktopapp::DesktopApp
# match '/desktop/settingconnection/', :to => Desktopapp::DesktopApp
match '/desktop/journal_p/', :to => Desktopapp::DesktopAppPublications
match '/desktop/journal_p_list/', :to => Desktopapp::DesktopAppPublications
match '/desktop/journal_p_add/', :to => Desktopapp::DesktopAppPublications
match '/desktop_publications/getjournals', :to => Desktopapp::DesktopAppPublications
# match '/desktop/journal_p/', :to => Desktopapp::DesktopAppPublications
# match '/desktop/journal_p_list/', :to => Desktopapp::DesktopAppPublications
# match '/desktop/journal_p_add/', :to => Desktopapp::DesktopAppPublications
# match '/desktop_publications/getjournals', :to => Desktopapp::DesktopAppPublications
# match '/desktop/twitter/', :to => Desktopapp::Otheraccounts
# match '/desktop/forgmail/', :to => Desktopapp::Otheraccounts
# match '/desktop/getaccounts', :to => Desktopapp::Otheraccounts
# match '/desktop/save_account_info/', :to => Desktopapp::Otheraccounts
match '/desktop_appstore/appstore', :to => Desktopapp::DesktopAppAppstore
match '/desktop_appstore/widgets', :to => Desktopapp::DesktopAppAppstore
match '/desktop_appstore/getuserwidgets', :to => Desktopapp::DesktopAppAppstore
match '/desktop_appstore/widgets_settings', :to => Desktopapp::DesktopAppAppstore
# match '/desktop_appstore/appstore', :to => Desktopapp::DesktopAppAppstore
# match '/desktop_appstore/widgets', :to => Desktopapp::DesktopAppAppstore
# match '/desktop_appstore/getuserwidgets', :to => Desktopapp::DesktopAppAppstore
# match '/desktop_appstore/widgets_settings', :to => Desktopapp::DesktopAppAppstore
# Sinatra Routes end
# match '/desktop/desktop'=>'desktop#desktop'
# match '/desktop/app_manager'=>'desktop#app_manager'
# match '/desktop/sections'=>'desktop#sections'
# match '/desktop/settings'=>'desktop#settings'
# match '/desktop/get_desktop_settings/'=>'desktop#get_desktop_settings'
# match '/desktop/save_desktop_settings/'=>'desktop#save_desktop_settings'
# match '/desktop/getgroups/'=>'desktop#getgroups'
# match '/desktop/getsectionlist/'=>'desktop#getsectionlist'
# match '/desktop/settingthemes/'=>'desktop#settingthemes'
# match '/desktop/settingsections/'=>'desktop#settingsections'
# match '/desktop/getapplist/'=>'desktop#getapplist'
# match '/desktop/newpositions/'=>'desktop#newpositions'
# match '/desktop/settingconnection/'=>'desktop#settingconnection'
match '/desktop/desktop'=>'desktop#desktop'
match '/desktop/app_manager'=>'desktop#app_manager'
match '/desktop/sections'=>'desktop#sections'
match '/desktop/settings'=>'desktop#settings'
match '/desktop/get_desktop_settings/'=>'desktop#get_desktop_settings'
match '/desktop/save_desktop_settings/'=>'desktop#save_desktop_settings'
match '/desktop/getgroups/'=>'desktop#getgroups'
match '/desktop/getsectionlist/'=>'desktop#getsectionlist'
match '/desktop/settingthemes/'=>'desktop#settingthemes'
match '/desktop/settingsections/'=>'desktop#settingsections'
match '/desktop/getapplist/'=>'desktop#getapplist'
match '/desktop/newpositions/'=>'desktop#newpositions'
match '/desktop/settingconnection/'=>'desktop#settingconnection'
# match '/desktop/journal_p/'=>'desktop_publications#journal_p'
# match '/desktop/journal_p_list/'=>'desktop_publications#journal_p_list'
# match '/desktop/journal_p_add/'=>'desktop_publications#journal_p_add'
# match '/desktop_publications/getjournals' => 'desktop_publications#getjournals'
match '/desktop/journal_p/'=>'desktop_publications#journal_p'
match '/desktop/journal_p_list/'=>'desktop_publications#journal_p_list'
match '/desktop/journal_p_add/'=>'desktop_publications#journal_p_add'
match '/desktop_publications/getjournals' => 'desktop_publications#getjournals'
match '/desktop/twitter/'=>'otheraccounts#twitter'
match '/desktop/forgmail/'=>'otheraccounts#gmail'
match '/desktop/getaccounts'=>'otheraccounts#getaccounts'
match '/desktop/save_account_info/'=>'otheraccounts#saveaccountinfo'
# match '/desktop_appstore/appstore'=>'desktop_appstore#appstore'
# match '/desktop_appstore/widgets'=>'desktop_appstore#widgets'
# match '/desktop_appstore/getuserwidgets'=>'desktop_appstore#getuserwidgets'
# match '/desktop_appstore/widgets_settings'=>'desktop_appstore#widgets_settings'
match '/desktop_appstore/appstore'=>'desktop_appstore#appstore'
match '/desktop_appstore/widgets'=>'desktop_appstore#widgets'
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/temp_func/'=>'desktop#temp_func'

12
public/test.json Normal file
View File

@ -0,0 +1,12 @@
{
"timeline":{
"heading" : "Title1",
"date" : "10012012",
"text" : "Think it's just another laptop? Think again. Designed to outperform standard laptops, the W520 PC is actually a mobile workstation — lightning-fast, heroically powerful and surprisingly portable. The work starts with the processor — from 2nd generation Intel® Core™ i5, up to Core™ i7 Quad Core™ Extreme, to keep your heavy-duty applications running flawlessly and boost your multi-tasking by 20 percent. Supplement that with the NVIDIA® Quadro® 1000M or 2000M graphics card with 2GB VRAM, professional-class graphics cards designed for up to 5x faster 3D performance and 8x faster computational simulation. Choose up to 16GB DDR3 RAM and you have one serious workstation — tested and certified by leading ISVs for more than 120 applications, including some of the most stringent in the industry."
},
{
"heading" : "Title2",
"date" : "15012012",
"text" : "Performance like this should include the most advanced features — and it does. Powerful graphics require a display that lives up to what they have to show; feast your eyes on our 95-percent color gamut LED display in HD, HD+ or FHD. For the most accurate color workflow, opt for the industry's first embedded X-Rite Color Calibrator. Transfer files 10x faster with USB 3.0, depend on the 34mm ExpressCard and MMC slot or optional Smart Card reader, avail yourself of the multiburner combo drive and enjoy our best-in-class, ergonomic keyboard and Ultranav™ with our TrackPoint and touchpad. And when you're ready to talk about all the work you've done, you'll get superior Web conferencing and VoIP, thanks to full-duplex voice transmission support, dual digital microphone modes with advanced noise-cancellation technology, optimized speakers and a light-adaptive, 720p, HD webcam."
}
}