timeline updates major ones..
This commit is contained in:
parent
555ec86403
commit
4aa155a44d
|
@ -8,61 +8,72 @@ var orbitTimeline = function(dom){
|
||||||
//this.marker = t.timelineHtml.find("#timline_marker");
|
//this.marker = t.timelineHtml.find("#timline_marker");
|
||||||
this.scale = t.timelineHtml.find("#timeline_scale");
|
this.scale = t.timelineHtml.find("#timeline_scale");
|
||||||
//this.container = t.timelineHtml.find("#t_container");
|
//this.container = t.timelineHtml.find("#t_container");
|
||||||
|
this.events = new Array;
|
||||||
|
this.monthList = ["","January","February","March","April","May","June","July","August","September","October","November","December"];
|
||||||
this.initialize = function(){
|
this.initialize = function(){
|
||||||
t.dom.html(t.timelineHtml);
|
t.dom.html(t.timelineHtml);
|
||||||
$("div.scrollbar").hide();
|
$("div.scrollbar").hide();
|
||||||
//var cursor = t.marker.draggable({containment:"parent","option":"cursorAt"});
|
t.constructTimeScale(function(timelineScale){
|
||||||
var timelineScale = t.constructTimeScale();
|
|
||||||
$("#timeline_scale").html(timelineScale);
|
$("#timeline_scale").html(timelineScale);
|
||||||
t.makeBubble("012012");
|
for(eve in t.events){
|
||||||
t.makeBubble("012012");
|
|
||||||
$("#test_bubble").click(function(){
|
|
||||||
t.makeBubble("062012");
|
|
||||||
})
|
|
||||||
|
|
||||||
|
t.makeBubble(t.events[eve]);
|
||||||
}
|
}
|
||||||
this.constructTimeScale = function(){
|
});
|
||||||
//$.getJSON("test.json",function(){
|
}
|
||||||
|
this.constructTimeScale = function(callbackFn){
|
||||||
|
var mon ="",year="";
|
||||||
var scale = $("<div id='scale_wrapper'></div>");
|
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>"));
|
$.getJSON("desktop_orbit/getevents",{"event":"papers"},function(journals){
|
||||||
scale.find(".scale_region").each(function(){
|
$.each(journals,function(x,journal){
|
||||||
var verticalchars = "";
|
$.each(journal.papers,function(i,paper){
|
||||||
var txt = $(this).text();
|
var dt = new Date(paper.created_at);
|
||||||
var margin = ($(this).width()-20)/2;
|
var cur_mon = paper.created_at.substr(5,2);
|
||||||
// for(c in txt){
|
var cur_year = dt.getFullYear();
|
||||||
// if($(this).hasClass('month')){
|
var cdt = paper.created_at.substr(0,7).replace("-","");
|
||||||
// verticalchars+="<span style='padding-left:"+margin+"px'>"+txt.charAt(c)+"</span>";
|
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}
|
||||||
// }else
|
t.events.push(bubbleData);
|
||||||
// verticalchars+="<span style='padding-left:5px'>"+txt.charAt(c)+"</span>";
|
if(cur_year != year){
|
||||||
// }
|
year = cur_year;
|
||||||
//$(this).html(verticalchars);
|
scale.append($("<div class='scale_region year'>"+(year+1)+"</div>"));
|
||||||
})
|
|
||||||
return scale;
|
|
||||||
//})
|
|
||||||
}
|
}
|
||||||
this.makeBubble = function(timestamp){
|
if(cur_mon != mon){
|
||||||
var totalul = $("#scale_wrapper").find("div[data-content="+timestamp+"] ul").length;
|
mon = cur_mon;
|
||||||
var targetul = $("#scale_wrapper div[data-content="+timestamp+"] div.bubble_list ul").eq(totalul-1);
|
scale.append($("<div class='scale_region month' data-content='"+cdt+"'><div class='month_heading'>"+t.monthList[parseInt(mon)]+"</div><div class='bubble_list'></div></div>"))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
scale.append($("<div class='scale_region year'>"+year+"</div>"));
|
||||||
|
if(typeof callbackFn == "function"){
|
||||||
|
callbackFn.call(this,scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.makeBubble = function(bubbleData){
|
||||||
|
var totalul = $("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] ul").length;
|
||||||
|
var targetul = $("#scale_wrapper div[data-content="+bubbleData.timestamp+"] div.bubble_list ul").eq(totalul-1);
|
||||||
if(totalul == 0){
|
if(totalul == 0){
|
||||||
var ul = $("<ul></ul>");
|
var ul = $("<ul></ul>");
|
||||||
$("#scale_wrapper").find("div[data-content="+timestamp+"] div.bubble_list").append(ul);
|
$("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] div.bubble_list").append(ul);
|
||||||
targetul = ul;
|
targetul = ul;
|
||||||
}else{
|
}else{
|
||||||
var totalli = targetul.find("li").length;
|
var totalli = targetul.find("li").length;
|
||||||
if(totalli >= 5){
|
if(totalli >= 5){
|
||||||
var ul = $("<ul></ul>");
|
var ul = $("<ul></ul>");
|
||||||
$("#scale_wrapper").find("div[data-content="+timestamp+"] div.bubble_list").append(ul);
|
$("#scale_wrapper").find("div[data-content="+bubbleData.timestamp+"] div.bubble_list").append(ul);
|
||||||
targetul = ul;
|
targetul = ul;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var bubble = $("<li class='bubble'>This is test bubble.</li>");
|
var bt = (bubbleData.title.length > 70? bubbleData.title.substr(0,70) + "..." : bubbleData.title);
|
||||||
|
var bubble = $("<li class='bubble'><span>"+bt+"<span class='date'> - "+bubbleData.fulldate+"</span></span></li>");
|
||||||
bubble.css("margin-left","25px");
|
bubble.css("margin-left","25px");
|
||||||
targetul.prepend(bubble);
|
targetul.prepend(bubble);
|
||||||
bubble.show("bounce",{},500);
|
bubble.show();
|
||||||
bubble.click(function(){
|
bubble.click(function(){
|
||||||
o.toolPopup({
|
o.toolPopup({
|
||||||
parent: $(this),
|
parent: $(this),
|
||||||
html : "<div><b><u>"+timestamp+"</u></b></div>",
|
html : "<div><h3>"+bubbleData.jtitle+"</h3><span><h2>Co-Authors: </h2>"+bubbleData.coauthors+"</span><span><h2>Abstract: </h2>"+bubbleData.abstract+"</span></div>",
|
||||||
height: "auto",
|
height: "auto",
|
||||||
width:"300px"
|
width:"300px"
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,9 +112,6 @@ var orbitDesktop = function(dom){
|
||||||
});
|
});
|
||||||
$("a#d_appstore").click(function(){
|
$("a#d_appstore").click(function(){
|
||||||
var target = $(this).attr("href");
|
var target = $(this).attr("href");
|
||||||
console.log(o.currenthtml);
|
|
||||||
console.log(target);
|
|
||||||
console.log(o.currentface);
|
|
||||||
if(o.currenthtml!=target){
|
if(o.currenthtml!=target){
|
||||||
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
o.desktopData[o.currentface] = $(o.contentHolder).html();
|
||||||
$("#content").hide("drop",o.transitionTime,function(){
|
$("#content").hide("drop",o.transitionTime,function(){
|
||||||
|
@ -907,7 +904,6 @@ var orbitDesktop = function(dom){
|
||||||
this.initializeOrbitTimeline = function(target){
|
this.initializeOrbitTimeline = function(target){
|
||||||
o.currenthtml = target;
|
o.currenthtml = target;
|
||||||
o.currentface = "orbit";
|
o.currentface = "orbit";
|
||||||
console.log(o.currentface);
|
|
||||||
var bindHandlers = function(){
|
var bindHandlers = function(){
|
||||||
var timeline = new orbitTimeline("timeline");
|
var timeline = new orbitTimeline("timeline");
|
||||||
timeline.initialize();
|
timeline.initialize();
|
||||||
|
|
|
@ -173,7 +173,7 @@ var orbitDesktopAPI = function(){
|
||||||
settings.width = (!settings.width ? "150px" : settings.width);
|
settings.width = (!settings.width ? "150px" : settings.width);
|
||||||
settings.html = (!settings.html ? "" : settings.html);
|
settings.html = (!settings.html ? "" : settings.html);
|
||||||
var leftpos = settings.parent.width();
|
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>");
|
var toolpopup = $("<div class='desktop_toolpopup' style='height:"+settings.height+";width:"+settings.width+"; left:"+leftpos+"px;'><span>"+settings.html+"</span></div>");
|
||||||
settings.parent.css("position","relative");
|
settings.parent.css("position","relative");
|
||||||
settings.parent.prepend(toolpopup);
|
settings.parent.prepend(toolpopup);
|
||||||
toolpopup.click(function(event){
|
toolpopup.click(function(event){
|
||||||
|
|
|
@ -724,6 +724,19 @@ a:focus { outline: none; }
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
border-color:black;
|
border-color:black;
|
||||||
font-size:15px;
|
font-size:15px;
|
||||||
padding: 5px 0px 10px 0px;
|
padding: 10px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
background-color:#ccc;
|
||||||
|
}
|
||||||
|
.desktop_toolpopup span{
|
||||||
|
margin:3px 0 3px 0;
|
||||||
|
}
|
||||||
|
.desktop_toolpopup h3{
|
||||||
|
text-align: center;
|
||||||
|
font-weight:bolder;
|
||||||
|
margin-bottom:5px;
|
||||||
|
}
|
||||||
|
.desktop_toolpopup h2{
|
||||||
|
font-weight:bolder;
|
||||||
|
margin-top:3px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.t_scale{
|
.t_scale{
|
||||||
width:2000px;
|
min-width:2000px;
|
||||||
height:516px;
|
height:516px;
|
||||||
bottom:0;
|
bottom:0;
|
||||||
}
|
}
|
||||||
|
@ -43,16 +43,15 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width:300px;
|
width:300px;
|
||||||
height:30px;
|
height:30px;
|
||||||
background:lightblue;
|
|
||||||
border-style:solid;
|
border-style:solid;
|
||||||
border-width:5px;
|
border-width:5px;
|
||||||
float: left;
|
float: left;
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom:10px;
|
margin-bottom:10px;
|
||||||
font-size:20px;
|
font-size:15px;
|
||||||
padding:5px;
|
padding:5px;
|
||||||
text-align:center;
|
text-align:justify;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.month_heading{
|
.month_heading{
|
||||||
|
@ -64,3 +63,7 @@
|
||||||
width:350px;
|
width:350px;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
.bubble_list ul li span.date{
|
||||||
|
font-weight:bolder;
|
||||||
|
float:right;
|
||||||
|
}
|
|
@ -4,4 +4,17 @@ class DesktopOrbitController< ApplicationController
|
||||||
render "desktop/orbit", :layout => false
|
render "desktop/orbit", :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def getevents
|
||||||
|
@event = params["event"]
|
||||||
|
@data = Array.new
|
||||||
|
case @event
|
||||||
|
when "papers"
|
||||||
|
@journals = current_user.journals
|
||||||
|
@journals.each do |journal|
|
||||||
|
@data << {"title"=> journal.title,"papers"=> journal.papers}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
render :json=>@data.to_json
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -12,14 +12,14 @@ class DesktopPublicationsController< ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_journal
|
def create_journal
|
||||||
Journal.create(user_id: current_user.id, title: "2012, Material Chemistry and Physics Journal")
|
Journal.create(user_id: current_user.id, title: "2012, Javascript")
|
||||||
b = Array.new
|
b = Array.new
|
||||||
b << {"success"=>"true"}
|
b << {"success"=>"true"}
|
||||||
render :json=>b.to_json
|
render :json=>b.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
def getjournals
|
def getjournals
|
||||||
@journals = Journal.all
|
@journals = current_user.journals
|
||||||
data = Array.new
|
data = Array.new
|
||||||
@journals.each do |journal|
|
@journals.each do |journal|
|
||||||
@papers = journal.papers.all
|
@papers = journal.papers.all
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Journal
|
||||||
before_create :initialize_paper
|
before_create :initialize_paper
|
||||||
|
|
||||||
def initialize_paper
|
def initialize_paper
|
||||||
for i in 0..25
|
for i in 0..5
|
||||||
self.papers.build
|
self.papers.build
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button id="test_bubble" style="z-index:10px; postion:absolute;">Add bubble</button>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -168,7 +168,8 @@ Orbit::Application.routes.draw do
|
||||||
match '/desktop_appstore/widgets_settings'=>'desktop_appstore#widgets_settings'
|
match '/desktop_appstore/widgets_settings'=>'desktop_appstore#widgets_settings'
|
||||||
|
|
||||||
match '/desktop_orbit/orbit' => 'desktop_orbit#orbit'
|
match '/desktop_orbit/orbit' => 'desktop_orbit#orbit'
|
||||||
|
match '/desktop_orbit/getevents' => 'desktop_orbit#getevents'
|
||||||
|
#match '/desktop_orbit/getevents' => 'desktop_publications#create_journal'
|
||||||
|
|
||||||
match '/desktop/temp_func/'=>'desktop#temp_func'
|
match '/desktop/temp_func/'=>'desktop#temp_func'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue