timeline_setter 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/Rakefile +11 -2
  2. data/config/assets.yml +9 -0
  3. data/doc/doc.markdown +65 -17
  4. data/doc/templates.html +3 -0
  5. data/doc/timeline-setter.html +327 -238
  6. data/doc/timeline-setter.min.html +3 -0
  7. data/documentation/TimelineSetter/CLI.html +77 -52
  8. data/documentation/TimelineSetter/Parser.html +40 -39
  9. data/documentation/TimelineSetter/Timeline.html +132 -83
  10. data/documentation/TimelineSetter.html +27 -12
  11. data/documentation/_index.html +23 -12
  12. data/documentation/class_list.html +20 -9
  13. data/documentation/css/style.css +7 -5
  14. data/documentation/file.README.html +33 -23
  15. data/documentation/file_list.html +20 -9
  16. data/documentation/frames.html +1 -1
  17. data/documentation/index.html +33 -23
  18. data/documentation/js/app.js +16 -14
  19. data/documentation/js/full_list.js +7 -6
  20. data/documentation/js/jquery.js +3 -3
  21. data/documentation/method_list.html +42 -23
  22. data/documentation/top-level-namespace.html +26 -11
  23. data/index.html +100 -19
  24. data/lib/timeline_setter/cli.rb +2 -0
  25. data/lib/timeline_setter/timeline.rb +6 -3
  26. data/lib/timeline_setter/version.rb +1 -1
  27. data/lib/timeline_setter.rb +0 -7
  28. data/public/javascripts/templates/card.jst +21 -0
  29. data/public/javascripts/templates/notch.jst +1 -0
  30. data/public/javascripts/templates/series_legend.jst +3 -0
  31. data/public/javascripts/templates/timeline.jst +20 -0
  32. data/public/javascripts/templates/year_notch.jst +3 -0
  33. data/public/javascripts/templates.js +1 -0
  34. data/public/javascripts/timeline-setter.js +303 -167
  35. data/public/javascripts/timeline-setter.min.js +1 -0
  36. data/public/stylesheets/timeline-setter.css +5 -5
  37. data/spec/timeline_setter_spec.rb +2 -2
  38. data/templates/timeline-markup.erb +5 -59
  39. data/timeline_setter.gemspec +15 -5
  40. metadata +15 -5
@@ -0,0 +1 @@
1
+ (function(e,i){var m=window.TimelineSetter=(window.TimelineSetter||{});var s=function(E){E.bind=function(I,F){var G=(this._callbacks=this._callbacks||{});var H=(G[I]=G[I]||[]);H.push(F)};E.trigger=function(H){if(!this._callbacks){return}var G=this._callbacks[H];if(!G){return}for(var F=0;F<G.length;F++){G[F].apply(this,arguments)}}};var B=function(E){E.move=function(G,F){if(!F.deltaX){return}if(_.isUndefined(this.currOffset)){this.currOffset=0}this.currOffset+=F.deltaX;this.el.css({left:this.currOffset})};E.zoom=function(G,F){if(!F.width){return}this.el.css({width:F.width})}};var c=function(F,E){F.$=function(G){return window.$(G,E)}};var A="ontouchstart" in document;if(A){e.event.props.push("touches")}var d=function(I){var G;function E(K){K.preventDefault();G={x:K.pageX};K.type="dragstart";I.el.trigger(K)}function F(K){if(!G){return}K.preventDefault();K.type="dragging";K=_.extend(K,{deltaX:(K.pageX||K.touches[0].pageX)-G.x});G={x:(K.pageX||K.touches[0].pageX)};I.el.trigger(K)}function J(K){if(!G){return}G=null;K.type="dragend";I.el.trigger(K)}if(!A){I.el.bind("mousedown",E);e(document).bind("mousemove",F);e(document).bind("mouseup",J)}else{var H;I.el.bind("touchstart",function(M){var K=Date.now();var N=K-(H||K);var L=N>0&&N<=250?"doubletap":"tap";G={x:M.touches[0].pageX};H=K;I.el.trigger(e.Event(L))});I.el.bind("touchmove",F);I.el.bind("touchend",J)}};var o=/WebKit\/533/.test(navigator.userAgent);var y=function(F){function E(H){H.preventDefault();var I=(H.wheelDelta||-H.detail);if(o){var G=I<0?-1:1;I=Math.log(Math.abs(I))*G*2}H.type="scrolled";H.deltaX=I;F.el.trigger(H)}F.el.bind("mousewheel DOMMouseScroll",E)};var w=function(){this.min=+Infinity;this.max=-Infinity};w.prototype.extend=function(E){this.min=Math.min(E,this.min);this.max=Math.max(E,this.max)};w.prototype.width=function(){return this.max-this.min};w.prototype.project=function(F,E){return(F-this.min)/this.width()*E};var h=function(G,E){this.max=G.max;this.min=G.min;if(!E||!this.INTERVALS[E]){var F=this.computeMaxInterval();this.maxInterval=this.INTERVAL_ORDER[F];this.idx=F}else{this.maxInterval=E;this.idx=_.indexOf(this.INTERVAL_ORDER,E)}};h.dateFormats=function(H){var J=new Date(H);var I={};var F=["Jan.","Feb.","March","April","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."];var G=J.getHours()>12;var E=J.getHours()>=12;I.month=F[J.getMonth()];I.year=J.getFullYear();I.date=I.month+" "+J.getDate()+", "+I.year;I.hourWithMinutes=(G?J.getHours()-12:(J.getHours()>0?J.getHours():"12"))+":"+z(J.getMinutes())+" "+(E?"p.m.":"a.m.");I.hourWithMinutesAndSeconds=I.hourWithMinutes+":"+z(J.getSeconds());return h.formatter(J,I)||I};h.dateStr=function(F,E){var G=new h.dateFormats(F);switch(E){case"Decade":return G.year;case"Lustrum":return G.year;case"FullYear":return G.year;case"Month":return G.month+", "+G.year;case"Week":return G.date;case"Date":return G.date;case"Hours":return G.hourWithMinutes;case"Minutes":return G.hourWithMinutes;case"Seconds":return G.hourWithMinutesAndSeconds}};h.prototype={INTERVALS:{Decade:315360000000,Lustrum:157680000000,FullYear:31536000000,Month:2592000000,Week:604800000,Date:86400000,Hours:3600000,Minutes:60000,Seconds:1000},INTERVAL_ORDER:["Seconds","Minutes","Hours","Date","Week","Month","FullYear","Lustrum","Decade"],isAtLeastA:function(E){return((this.max-this.min)>this.INTERVALS[E])},computeMaxInterval:function(){for(var E=0;E<this.INTERVAL_ORDER.length;E++){if(!this.isAtLeastA(this.INTERVAL_ORDER[E])){break}}return E-1},getMaxInterval:function(){return this.INTERVALS[this.INTERVAL_ORDER[this.idx]]},getDecade:function(E){return(E.getFullYear()/10|0)*10},getLustrum:function(E){return(E.getFullYear()/5|0)*5},getWeekFloor:function(E){thisDate=new Date(E.getFullYear(),E.getMonth(),E.getDate());thisDate.setDate(E.getDate()-E.getDay());return thisDate},getWeekCeil:function(E){thisDate=new Date(E.getFullYear(),E.getMonth(),E.getDate());thisDate.setDate(thisDate.getDate()+(7-E.getDay()));return thisDate},floor:function(G){var F=new Date(G);var H=this.INTERVAL_ORDER[this.idx];var E=this.idx>_.indexOf(this.INTERVAL_ORDER,"FullYear")?_.indexOf(this.INTERVAL_ORDER,"FullYear"):E;switch(H){case"Decade":F.setFullYear(this.getDecade(F));break;case"Lustrum":F.setFullYear(this.getLustrum(F));break;case"Week":F.setDate(this.getWeekFloor(F).getDate());E=_.indexOf(this.INTERVAL_ORDER,"Week")}while(E--){H=this.INTERVAL_ORDER[E];if(H!=="Week"){F["set"+H](H==="Date"?1:0)}}return F.getTime()},ceil:function(F){var E=new Date(this.floor(F));var G=this.INTERVAL_ORDER[this.idx];switch(G){case"Decade":E.setFullYear(this.getDecade(E)+10);break;case"Lustrum":E.setFullYear(this.getLustrum(E)+5);break;case"Week":E.setTime(this.getWeekCeil(E).getTime());break;default:E["set"+G](E["get"+G]()+1)}return E.getTime()},span:function(E){return this.ceil(E)-this.floor(E)},getRanges:function(){if(this.intervals){return this.intervals}this.intervals=[];for(var E=this.floor(this.min);E<=this.ceil(this.max);E+=this.span(E)){this.intervals.push({human:h.dateStr(E,this.maxInterval),timestamp:E})}return this.intervals}};var n=function(E,G){var F=Array.prototype.slice.call(arguments,2);_.each(F,function(H){E.bind(H,function(){G[H].apply(G,arguments)})})};var v=function(E){return parseInt(E.replace(/^[^+\-\d]?([+\-]?\d+)?.*$/,"$1"),10)};var z=function(E){return(E<10?"0":"")+E};var t=/^#*/;var r={get:function(){return window.location.hash.replace(t,"")},set:function(E){window.location.hash=E}};var x=1;var u=function(){var E;if(x<10){E=x;x+=1}else{E="default"}return E};var j=m.Timeline=function(F,E){_.bindAll(this,"render");this.data=F.sort(function(H,G){return H.timestamp-G.timestamp});this.bySid={};this.cards=[];this.series=[];this.config=E;this.config.container=this.config.container||"#timeline";h.formatter=this.config.formatter||function(H,G){return G}};s(j.prototype);j.prototype=_.extend(j.prototype,{render:function(){var F=this;c(this,this.config.container);e(this.config.container).html(JST.timeline());this.bounds=new w();this.bar=new b(this);this.cardCont=new q(this);this.createSeries(this.data);var E=new h(this.bounds,this.config.interval);this.intervals=E.getRanges();this.bounds.extend(this.bounds.min-E.getMaxInterval()/2);this.bounds.extend(this.bounds.max+E.getMaxInterval()/2);this.bar.render();n(this.bar,this.cardCont,"move","zoom");this.trigger("render");new f("in",this);new f("out",this);this.chooseNext=new C("next",this);this.choosePrev=new C("prev",this);if(!this.$(".TS-card_active").is("*")){this.chooseNext.click()}e(this.config.container).bind("click",_.bind(this.setGlobalCurrentTimeline,this));this.trigger("load")},setGlobalCurrentTimeline:function(){m.currentTimeline=this},createSeries:function(F){for(var E=0;E<F.length;E++){this.add(F[E])}},add:function(E){if(!(E.series in this.bySid)){this.bySid[E.series]=new l(E,this);this.series.push(this.bySid[E.series])}var F=this.bySid[E.series];F.add(E);this.bounds.extend(F.max());this.bounds.extend(F.min());this.trigger("cardAdd",E)}});var b=function(F){var E=this;this.timeline=F;this.el=this.timeline.$(".TS-notchbar");this.el.css({left:0});d(this);y(this);_.bindAll(this,"moving","doZoom");this.el.bind("dragging scrolled",this.moving);this.el.bind("doZoom",this.doZoom);this.el.bind("dblclick doubletap",function(G){G.preventDefault();E.timeline.$(".TS-zoom_in").click()})};s(b.prototype);B(b.prototype);b.prototype=_.extend(b.prototype,{moving:function(H){var G=this.el.parent();var F=G.offset().left;var I=this.el.offset().left;var E=this.el.width();if(_.isUndefined(H.deltaX)){H.deltaX=0}if(I+E+H.deltaX<F+G.width()){H.deltaX=(F+G.width())-(I+E)}if(I+H.deltaX>F){H.deltaX=F-I}this.trigger("move",H);this.timeline.trigger("move",H);this.move("move",H)},doZoom:function(J,F){var G=this;var E=this.timeline.$(".TS-notch_active");var I=function(){return E.length>0?E.position().left:0};var H=I();this.el.animate({width:F+"%"},{step:function(M,K){var L=e.Event("dragging");var N=H-I();L.deltaX=N;G.moving(L);H=I();L=e.Event("zoom");L.width=M+"%";G.trigger("zoom",L)}})},render:function(){var G=this.timeline.intervals;var H=this.timeline.bounds;for(var F=0;F<G.length;F++){var E=JST.year_notch({timestamp:G[F].timestamp,human:G[F].human});this.el.append(e(E).css("left",H.project(G[F].timestamp,100)+"%"))}}});var q=function(E){this.el=E.$(".TS-card_scroller_inner")};s(q.prototype);B(q.prototype);var l=function(E,F){this.timeline=F;this.name=E.series;this.color=this.name.length>0?u():"default";this.cards=[];_.bindAll(this,"render","showNotches","hideNotches");this.timeline.bind("render",this.render)};s(l.prototype);l.prototype=_.extend(l.prototype,{add:function(E){var F=new k(E,this);this.cards.push(F)},_comparator:function(E){return E.timestamp},hideNotches:function(E){E.preventDefault();this.el.addClass("TS-series_legend_item_inactive");this.trigger("hideNotch")},showNotches:function(E){E.preventDefault();this.el.removeClass("TS-series_legend_item_inactive");this.trigger("showNotch")},render:function(E){if(this.name.length===0){return}this.el=e(JST.series_legend(this));this.timeline.$(".TS-series_nav_container").append(this.el);this.el.toggle(this.hideNotches,this.showNotches)}});_(["min","max"]).each(function(E){l.prototype[E]=function(){return _[E].call(_,this.cards,this._comparator).get("timestamp")}});var k=function(E,F){this.series=F;this.timeline=this.series.timeline;E=_.clone(E);this.timestamp=E.timestamp;this.attributes=E;this.attributes.topcolor=F.color;_.bindAll(this,"render","activate","flip","setPermalink","toggleNotch");this.series.bind("hideNotch",this.toggleNotch);this.series.bind("showNotch",this.toggleNotch);this.timeline.bind("render",this.render);this.timeline.bar.bind("flip",this.flip);this.id=[this.get("timestamp"),this.get("description").split(/ /)[0].replace(/[^a-zA-Z\-]/g,"")].join("-");this.timeline.cards.push(this)};k.prototype=_.extend(k.prototype,{get:function(E){return this.attributes[E]},render:function(){this.offset=this.timeline.bounds.project(this.timestamp,100);var E=JST.notch(this.attributes);this.notch=e(E).css({left:this.offset+"%"});this.timeline.$(".TS-notchbar").append(this.notch);this.notch.click(this.activate);if(r.get()===this.id){this.activate()}},flip:function(){if(!this.el||!this.el.is(":visible")){return}var E=this.$(".TS-item").offset().left+this.$(".TS-item").width();var I=this.timeline.$(".timeline_setter").offset().left+this.timeline.$(".timeline_setter").width();var H=this.el.css("margin-left")===this.originalMargin;var G=this.$(".TS-item").width()<this.timeline.$(".timeline_setter").width()/2;var F=this.el.position().left-this.$(".TS-item").width()<0;if(I-E<0&&H&&!F){this.el.css({"margin-left":-(this.$(".TS-item").width()+7)});this.$(".TS-css_arrow").css({left:this.$(".TS-item").width()})}else{if(this.el.offset().left-this.timeline.$(".timeline_setter").offset().left<0&&!H&&G){this.el.css({"margin-left":this.originalMargin});this.$(".TS-css_arrow").css({left:0})}}},activate:function(F){var E=this;this.hideActiveCard();if(!this.el){this.el=e(JST.card({card:this}));c(this,this.el);this.el.css({left:this.offset+"%"});this.timeline.$(".TS-card_scroller_inner").append(this.el);this.originalMargin=this.el.css("margin-left");this.el.delegate(".TS-permalink","click",this.setPermalink);this.timeline.$("img").load(this.activate)}this.el.show().addClass(("TS-card_active"));this.notch.addClass("TS-notch_active");this.setWidth();this.flip();this.move();this.series.timeline.trigger("cardActivate",this.attributes)},setWidth:function(){var F=this;var E=_.max(_.toArray(this.$(".TS-item_user_html").children()),function(G){return F.$(G).width()});if(this.$(E).width()>this.$(".TS-item_year").width()){this.$(".TS-item_label").css("width",this.$(E).width())}else{this.$(".TS-item_label").css("width",this.$(".TS-item_year").width())}},move:function(){var F=e.Event("moving");var G=this.$(".TS-item").offset();var E=this.timeline.$(".timeline_setter").offset();if(G.left<E.left){F.deltaX=E.left-G.left+v(this.$(".TS-item").css("padding-left"));this.timeline.bar.moving(F)}else{if(G.left+this.$(".TS-item").outerWidth()>E.left+this.timeline.$(".timeline_setter").width()){F.deltaX=E.left+this.timeline.$(".timeline_setter").width()-(G.left+this.$(".TS-item").outerWidth());this.timeline.bar.moving(F)}}},setPermalink:function(){r.set(this.id)},hideActiveCard:function(){this.timeline.$(".TS-card_active").removeClass("TS-card_active").hide();this.timeline.$(".TS-notch_active").removeClass("TS-notch_active")},toggleNotch:function(E){switch(E){case"hideNotch":this.notch.hide().removeClass("TS-notch_active").addClass("TS-series_inactive");if(this.el){this.el.hide()}return;case"showNotch":this.notch.removeClass("TS-series_inactive").show()}}});var g=function(){};var p=function(F,E){g.prototype=E.prototype;F.prototype=new g();F.prototype.constructor=F};var D=function(G,F){this.timeline=F;this.direction=G;this.el=this.timeline.$(this.prefix+G);var E=this;this.el.bind("click",function(H){H.preventDefault();E.click(H)})};var a=100;var f=function(F,E){D.apply(this,arguments)};p(f,D);f.prototype=_.extend(f.prototype,{prefix:".TS-zoom_",click:function(){a+=(this.direction==="in"?+100:-100);if(a>=100){this.timeline.$(".TS-notchbar").trigger("doZoom",[a])}else{a=100}}});var C=function(F,E){D.apply(this,arguments);this.notches=this.timeline.$(".TS-notch")};p(C,D);C.prototype=_.extend(D.prototype,{prefix:".TS-choose_",click:function(I){var F;var H=this.notches.not(".TS-series_inactive");var E=H.index(this.timeline.$(".TS-notch_active"));var G=H.length;if(this.direction==="next"){F=(E<G?H.eq(E+1):false)}else{F=(E>0?H.eq(E-1):false)}if(!F){return}F.trigger("click")}});m.Api=function(E){this.timeline=E};m.Api.prototype=_.extend(m.Api.prototype,{onLoad:function(E){this.timeline.bind("load",E)},onCardAdd:function(E){this.timeline.bind("cardAdd",E)},onCardActivate:function(E){this.timeline.bind("cardActivate",E)},onBarMove:function(E){this.timeline.bind("move",E)},activateCard:function(E){_(this.timeline.cards).detect(function(F){return F.timestamp===E}).activate()}});m.bindKeydowns=function(){e(document).bind("keydown",function(E){if(m.currentTimeline&&E.keyCode===39){m.currentTimeline.chooseNext.click()}else{if(m.currentTimeline&&E.keyCode===37){m.currentTimeline.choosePrev.click()}else{return}}})};j.boot=function(H,E){var G=m.timeline=new j(H,E||{});var F=new m.Api(G);if(!m.pageTimelines){m.currentTimeline=G;m.bindKeydowns()}m.pageTimelines=m.pageTimelines?m.pageTimelines+=1:1;e(G.render);return{timeline:G,api:F}}})(jQuery);(function(){window.JST=window.JST||{};var a=function(c){var b=new Function("obj","var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/<%=([\s\S]+?)%>/g,function(d,e){return"',"+e.replace(/\\'/g,"'")+",'"}).replace(/<%([\s\S]+?)%>/g,function(d,e){return"');"+e.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');");return b};window.JST.card=a('<div class="TS-card_container TS-card_container_<%= (card.get("series") || "").replace(/W/g, "") %>">\n<div class="TS-css_arrow TS-css_arrow_up TS-css_arrow_color_<%= card.get("topcolor") %>"></div>\n <div class="TS-item TS-item_color_<%= card.get("topcolor") %>" data-timestamp="<%= card.get("timestamp") %>">\n <div class="TS-item_label">\n <% if (!_.isEmpty(card.get("html"))){ %>\n <div class="TS-item_user_html">\n <%= card.get("html") %>\n </div>\n <% } %>\n <%= card.get("description") %>\n </div>\n <% if (!_.isEmpty(card.get("link"))){ %>\n <a class="TS-read_btn" target="_blank" href="<%= card.get("link") %>">Read More</a>\n <% } %>\n\n <div class="TS-item_year">\n <span class="TS-item_year_text"><%= (card.get("display_date") || "").length > 0 ? card.get("display_date") : card.get("date") %></span>\n <div class="TS-permalink">&#8734;</div>\n </div>\n </div>\n</div>');window.JST.notch=a('<div class="TS-notch TS-notch_<%= timestamp %> TS-notch_<%= series.replace(/W/g, "") %> TS-notch_color_<%= topcolor %>"></div>\n');window.JST.series_legend=a('<div class="TS-series_legend_item TS-series_legend_item_<%= name.replace(/W/g, "") %>">\n <span class="TS-series_legend_swatch TS-series_legend_swatch_<%= color %>">&nbsp;</span> <span class="TS-series_legend_text"><%= name %></span>\n</div>\n');window.JST.timeline=a('<div class="timeline_setter">\n <div class="TS-top_matter_container">\n <div class="TS-controls">\n <a href="#" class="TS-zoom TS-zoom_in"><span class="TS-controls_inner_text TS-zoom_inner_text">+</span></a> \n <a href="#" class="TS-zoom TS-zoom_out"><span class="TS-controls_inner_text TS-zoom_inner_text">-</span></a> \n &nbsp;&nbsp;&nbsp;&nbsp; \n <a href="#" class="TS-choose TS-choose_prev">&laquo;&nbsp;<span class="TS-controls_inner_text">Previous</span></a> \n <a href="#" class="TS-choose TS-choose_next"><span class="TS-controls_inner_text">Next</span>&nbsp;&raquo;</a>\n </div>\n <div class="TS-series_nav_container"></div>\n </div>\n\n <div class="TS-notchbar_container">\n <div class="TS-notchbar"></div>\n </div>\n <div class="TS-card_scroller">\n <div class="TS-card_scroller_inner">\n </div>\n </div>\n</div>');window.JST.year_notch=a('<div class="TS-year_notch TS-year_notch_<%= timestamp %>">\n <span class="TS-year_notch_year_text"><%= human %></span>\n</div>\n')})();
@@ -1,4 +1,4 @@
1
- #timeline_setter {
1
+ .timeline_setter {
2
2
  width:85%;
3
3
  margin:0 auto;
4
4
  padding:10px;
@@ -77,12 +77,12 @@
77
77
  .TS-read_btn:hover {
78
78
  color:black;cursor:pointer;text-decoration:none;background:#cecece;
79
79
  }
80
- #timeline_setter a {
80
+ .timeline_setter a {
81
81
  text-decoration:none;
82
82
  color:#333;
83
83
  }
84
84
 
85
- #TS-top_matter_container {
85
+ .TS-top_matter_container {
86
86
  -webkit-user-select: none;
87
87
  -khtml-user-select: none;
88
88
  -moz-user-select: none;
@@ -108,13 +108,13 @@
108
108
  user-select: none;
109
109
  cursor: col-resize;
110
110
  }
111
- #TS-card_scroller {
111
+ .TS-card_scroller {
112
112
  width:100%;
113
113
  position:relative;
114
114
  overflow:hidden;
115
115
  height:800px; /* FIX THIS!!! */
116
116
  }
117
- #TS-card_scroller_inner {
117
+ .TS-card_scroller_inner {
118
118
  width:100%;
119
119
  position:relative;
120
120
  }
@@ -39,7 +39,7 @@ describe "TimelineSetter core" do
39
39
  # test to see we've compiled all the assets
40
40
 
41
41
  # test CSS
42
- html.should =~ /#timeline_setter/
42
+ html.should =~ /#timeline/
43
43
  # test timeline
44
44
  html.should =~ /"timestamp":1045544400/
45
45
  # test underscore
@@ -79,7 +79,7 @@ describe "TimelineSetter CLI" do
79
79
  # test to see we've compiled all the assets
80
80
 
81
81
  # test CSS
82
- file.should =~ /#timeline_setter/
82
+ file.should =~ /#timeline/
83
83
  # test timeline
84
84
  file.should =~ /"timestamp":1045544400/
85
85
  # test underscore
@@ -1,61 +1,7 @@
1
-
2
- <div id="timeline_setter">
3
- <div id="TS-top_matter_container">
4
- <div class="TS-controls">
5
- <a href="#" class="TS-zoom TS-zoom_in"><span class="TS-controls_inner_text TS-zoom_inner_text">+</span></a>
6
- <a href="#" class="TS-zoom TS-zoom_out"><span class="TS-controls_inner_text TS-zoom_inner_text">-</span></a>
7
- &nbsp;&nbsp;&nbsp;&nbsp;
8
- <a href="#" class="TS-choose TS-choose_prev">&laquo;&nbsp;<span class="TS-controls_inner_text">Previous</span></a>
9
- <a href="#" class="TS-choose TS-choose_next"><span class="TS-controls_inner_text">Next</span>&nbsp;&raquo;</a>
10
- </div>
11
- <div class="TS-series_nav_container"></div>
12
- </div>
13
-
14
- <div class="TS-notchbar_container">
15
- <div class="TS-notchbar"></div>
16
- </div>
17
- <div id="TS-card_scroller">
18
- <div id="TS-card_scroller_inner">
19
- </div>
20
- </div>
21
- </div>
22
-
1
+ <div id="timeline"></div>
23
2
  <script type="text/javascript">
24
- TimelineSetter.Timeline.boot(<%= self.to_json %>, <%= self.interval_json %>);
25
- </script>
26
- <script id="TS-year_notch_tmpl" type="text/jst">
27
- <div class="TS-year_notch TS-year_notch_<%%= timestamp %>">
28
- <span class="TS-year_notch_year_text"><%%= human %></span>
29
- </div>
30
- </script>
31
- <script id="TS-notch_tmpl" type="text/jst">
32
- <div class="TS-notch TS-notch_<%%= timestamp %> TS-notch_<%%= series.replace(/\W/g, "") %> TS-notch_color_<%%= topcolor %>"></div>
33
- </script>
34
- <script id="TS-series_legend_tmpl" type="text/jst">
35
- <div class="TS-series_legend_item TS-series_legend_item_<%%= name.replace(/\W/g, "") %>">
36
- <span class="TS-series_legend_swatch TS-series_legend_swatch_<%%= color %>">&nbsp;</span> <span class="TS-series_legend_text"><%%= name %></span>
37
- </div>
38
- </script>
39
- <script id="TS-card_tmpl" type="text/jst">
40
- <div class="TS-card_container TS-card_container_<%%= (card.get("series") || "").replace(/\W/g, "") %>">
41
- <div class="TS-css_arrow TS-css_arrow_up TS-css_arrow_color_<%%= card.get("topcolor") %>"></div>
42
- <div class="TS-item TS-item_color_<%%= card.get("topcolor") %>" data-timestamp="<%%= card.get("timestamp") %>">
43
- <div class="TS-item_label">
44
- <%% if (!_.isEmpty(card.get("html"))){ %>
45
- <div class="TS-item_user_html">
46
- <%%= card.get("html") %>
47
- </div>
48
- <%% } %>
49
- <%%= card.get("description") %>
50
- </div>
51
- <%% if (!_.isEmpty(card.get("link"))){ %>
52
- <a class="TS-read_btn" target="_blank" href="<%%= card.get("link") %>">Read More</a>
53
- <%% } %>
54
-
55
- <div class="TS-item_year">
56
- <span class="TS-item_year_text"><%%= (card.get("display_date") || "").length > 0 ? card.get("display_date") : card.get("date") %></span>
57
- <div class="TS-permalink">&#8734;</div>
58
- </div>
59
- </div>
60
- </div>
3
+ var currentTimeline = TimelineSetter.Timeline.boot(
4
+ <%= self.to_json %>,
5
+ <%= self.config_json %>
6
+ );
61
7
  </script>
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{timeline_setter}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Al Shaw", "Jeff Larson"]
12
- s.date = %q{2011-07-11}
12
+ s.date = %q{2011-11-02}
13
13
  s.default_executable = %q{timeline-setter}
14
14
  s.description = %q{TimelineSetter is a tool to create HTML timelines from spreadsheets of events.}
15
15
  s.email = %q{almshaw@gmail.com}
@@ -24,10 +24,13 @@ Gem::Specification.new do |s|
24
24
  "README",
25
25
  "Rakefile",
26
26
  "bin/timeline-setter",
27
+ "config/assets.yml",
27
28
  "doc/doc.markdown",
28
29
  "doc/doc_wrapper.erb",
29
30
  "doc/docco.css",
31
+ "doc/templates.html",
30
32
  "doc/timeline-setter.html",
33
+ "doc/timeline-setter.min.html",
31
34
  "doc/todo.markdown",
32
35
  "doc/twitter-demo.html",
33
36
  "documentation/TimelineSetter.html",
@@ -55,7 +58,14 @@ Gem::Specification.new do |s|
55
58
  "lib/timeline_setter/parser.rb",
56
59
  "lib/timeline_setter/timeline.rb",
57
60
  "lib/timeline_setter/version.rb",
61
+ "public/javascripts/templates.js",
62
+ "public/javascripts/templates/card.jst",
63
+ "public/javascripts/templates/notch.jst",
64
+ "public/javascripts/templates/series_legend.jst",
65
+ "public/javascripts/templates/timeline.jst",
66
+ "public/javascripts/templates/year_notch.jst",
58
67
  "public/javascripts/timeline-setter.js",
68
+ "public/javascripts/timeline-setter.min.js",
59
69
  "public/javascripts/vendor/jquery-min.js",
60
70
  "public/javascripts/vendor/underscore-min.js",
61
71
  "public/stylesheets/timeline-setter.css",
@@ -80,20 +90,20 @@ Gem::Specification.new do |s|
80
90
  s.add_runtime_dependency(%q<json>, [">= 0"])
81
91
  s.add_runtime_dependency(%q<table_fu>, [">= 0"])
82
92
  s.add_runtime_dependency(%q<kompress>, [">= 0.0.2"])
83
- s.add_runtime_dependency(%q<closure-compiler>, [">= 0"])
93
+ s.add_runtime_dependency(%q<jammit>, [">= 0"])
84
94
  s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
85
95
  else
86
96
  s.add_dependency(%q<json>, [">= 0"])
87
97
  s.add_dependency(%q<table_fu>, [">= 0"])
88
98
  s.add_dependency(%q<kompress>, [">= 0.0.2"])
89
- s.add_dependency(%q<closure-compiler>, [">= 0"])
99
+ s.add_dependency(%q<jammit>, [">= 0"])
90
100
  s.add_dependency(%q<rspec>, [">= 2.0.0"])
91
101
  end
92
102
  else
93
103
  s.add_dependency(%q<json>, [">= 0"])
94
104
  s.add_dependency(%q<table_fu>, [">= 0"])
95
105
  s.add_dependency(%q<kompress>, [">= 0.0.2"])
96
- s.add_dependency(%q<closure-compiler>, [">= 0"])
106
+ s.add_dependency(%q<jammit>, [">= 0"])
97
107
  s.add_dependency(%q<rspec>, [">= 2.0.0"])
98
108
  end
99
109
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timeline_setter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Al Shaw
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-11 00:00:00 -04:00
19
+ date: 2011-11-02 00:00:00 -04:00
20
20
  default_executable: timeline-setter
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ dependencies:
64
64
  type: :runtime
65
65
  version_requirements: *id003
66
66
  - !ruby/object:Gem::Dependency
67
- name: closure-compiler
67
+ name: jammit
68
68
  prerelease: false
69
69
  requirement: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
@@ -108,10 +108,13 @@ files:
108
108
  - README
109
109
  - Rakefile
110
110
  - bin/timeline-setter
111
+ - config/assets.yml
111
112
  - doc/doc.markdown
112
113
  - doc/doc_wrapper.erb
113
114
  - doc/docco.css
115
+ - doc/templates.html
114
116
  - doc/timeline-setter.html
117
+ - doc/timeline-setter.min.html
115
118
  - doc/todo.markdown
116
119
  - doc/twitter-demo.html
117
120
  - documentation/TimelineSetter.html
@@ -139,7 +142,14 @@ files:
139
142
  - lib/timeline_setter/parser.rb
140
143
  - lib/timeline_setter/timeline.rb
141
144
  - lib/timeline_setter/version.rb
145
+ - public/javascripts/templates.js
146
+ - public/javascripts/templates/card.jst
147
+ - public/javascripts/templates/notch.jst
148
+ - public/javascripts/templates/series_legend.jst
149
+ - public/javascripts/templates/timeline.jst
150
+ - public/javascripts/templates/year_notch.jst
142
151
  - public/javascripts/timeline-setter.js
152
+ - public/javascripts/timeline-setter.min.js
143
153
  - public/javascripts/vendor/jquery-min.js
144
154
  - public/javascripts/vendor/underscore-min.js
145
155
  - public/stylesheets/timeline-setter.css