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.
- data/Rakefile +11 -2
- data/config/assets.yml +9 -0
- data/doc/doc.markdown +65 -17
- data/doc/templates.html +3 -0
- data/doc/timeline-setter.html +327 -238
- data/doc/timeline-setter.min.html +3 -0
- data/documentation/TimelineSetter/CLI.html +77 -52
- data/documentation/TimelineSetter/Parser.html +40 -39
- data/documentation/TimelineSetter/Timeline.html +132 -83
- data/documentation/TimelineSetter.html +27 -12
- data/documentation/_index.html +23 -12
- data/documentation/class_list.html +20 -9
- data/documentation/css/style.css +7 -5
- data/documentation/file.README.html +33 -23
- data/documentation/file_list.html +20 -9
- data/documentation/frames.html +1 -1
- data/documentation/index.html +33 -23
- data/documentation/js/app.js +16 -14
- data/documentation/js/full_list.js +7 -6
- data/documentation/js/jquery.js +3 -3
- data/documentation/method_list.html +42 -23
- data/documentation/top-level-namespace.html +26 -11
- data/index.html +100 -19
- data/lib/timeline_setter/cli.rb +2 -0
- data/lib/timeline_setter/timeline.rb +6 -3
- data/lib/timeline_setter/version.rb +1 -1
- data/lib/timeline_setter.rb +0 -7
- data/public/javascripts/templates/card.jst +21 -0
- data/public/javascripts/templates/notch.jst +1 -0
- data/public/javascripts/templates/series_legend.jst +3 -0
- data/public/javascripts/templates/timeline.jst +20 -0
- data/public/javascripts/templates/year_notch.jst +3 -0
- data/public/javascripts/templates.js +1 -0
- data/public/javascripts/timeline-setter.js +303 -167
- data/public/javascripts/timeline-setter.min.js +1 -0
- data/public/stylesheets/timeline-setter.css +5 -5
- data/spec/timeline_setter_spec.rb +2 -2
- data/templates/timeline-markup.erb +5 -59
- data/timeline_setter.gemspec +15 -5
- metadata +15 -5
@@ -2,11 +2,19 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
10
18
|
<base id="base_target" target="_parent" />
|
11
19
|
</head>
|
12
20
|
<body>
|
@@ -19,9 +27,13 @@
|
|
19
27
|
<div id="content">
|
20
28
|
<h1 id="full_list_header">Method List</h1>
|
21
29
|
<div id="nav">
|
22
|
-
|
23
|
-
|
24
|
-
|
30
|
+
|
31
|
+
<a target="_self" href="class_list.html">Classes</a>
|
32
|
+
|
33
|
+
<a target="_self" href="method_list.html">Methods</a>
|
34
|
+
|
35
|
+
<a target="_self" href="file_list.html">Files</a>
|
36
|
+
|
25
37
|
</div>
|
26
38
|
<div id="search">Search: <input type="text" /></div>
|
27
39
|
|
@@ -37,9 +49,9 @@
|
|
37
49
|
|
38
50
|
|
39
51
|
<li class="r2 ">
|
40
|
-
<span class='object_link'><a href="TimelineSetter/
|
52
|
+
<span class='object_link'><a href="TimelineSetter/Timeline.html#config_json-instance_method" title="TimelineSetter::Timeline#config_json (method)">#config_json</a></span>
|
41
53
|
|
42
|
-
<small>TimelineSetter::
|
54
|
+
<small>TimelineSetter::Timeline</small>
|
43
55
|
|
44
56
|
</li>
|
45
57
|
|
@@ -53,15 +65,15 @@
|
|
53
65
|
|
54
66
|
|
55
67
|
<li class="r2 ">
|
56
|
-
<span class='object_link'><a href="TimelineSetter/
|
68
|
+
<span class='object_link'><a href="TimelineSetter/Parser.html#events-instance_method" title="TimelineSetter::Parser#events (method)">#events</a></span>
|
57
69
|
|
58
|
-
<small>TimelineSetter::
|
70
|
+
<small>TimelineSetter::Parser</small>
|
59
71
|
|
60
72
|
</li>
|
61
73
|
|
62
74
|
|
63
75
|
<li class="r1 ">
|
64
|
-
<span class='object_link'><a href="TimelineSetter/CLI.html#
|
76
|
+
<span class='object_link'><a href="TimelineSetter/CLI.html#html-instance_method" title="TimelineSetter::CLI#html (method)">#html</a></span>
|
65
77
|
|
66
78
|
<small>TimelineSetter::CLI</small>
|
67
79
|
|
@@ -77,6 +89,14 @@
|
|
77
89
|
|
78
90
|
|
79
91
|
<li class="r1 ">
|
92
|
+
<span class='object_link'><a href="TimelineSetter/CLI.html#initialize-instance_method" title="TimelineSetter::CLI#initialize (method)">#initialize</a></span>
|
93
|
+
|
94
|
+
<small>TimelineSetter::CLI</small>
|
95
|
+
|
96
|
+
</li>
|
97
|
+
|
98
|
+
|
99
|
+
<li class="r2 ">
|
80
100
|
<span class='object_link'><a href="TimelineSetter/Parser.html#initialize-instance_method" title="TimelineSetter::Parser#initialize (method)">#initialize</a></span>
|
81
101
|
|
82
102
|
<small>TimelineSetter::Parser</small>
|
@@ -84,7 +104,7 @@
|
|
84
104
|
</li>
|
85
105
|
|
86
106
|
|
87
|
-
<li class="
|
107
|
+
<li class="r1 ">
|
88
108
|
<span class='object_link'><a href="TimelineSetter/CLI.html#outdir-instance_method" title="TimelineSetter::CLI#outdir (method)">#outdir</a></span>
|
89
109
|
|
90
110
|
<small>TimelineSetter::CLI</small>
|
@@ -92,7 +112,7 @@
|
|
92
112
|
</li>
|
93
113
|
|
94
114
|
|
95
|
-
<li class="
|
115
|
+
<li class="r2 ">
|
96
116
|
<span class='object_link'><a href="TimelineSetter/CLI.html#parse_options%21-instance_method" title="TimelineSetter::CLI#parse_options! (method)">#parse_options!</a></span>
|
97
117
|
|
98
118
|
<small>TimelineSetter::CLI</small>
|
@@ -100,7 +120,7 @@
|
|
100
120
|
</li>
|
101
121
|
|
102
122
|
|
103
|
-
<li class="
|
123
|
+
<li class="r1 ">
|
104
124
|
<span class='object_link'><a href="TimelineSetter/CLI.html#sheet-instance_method" title="TimelineSetter::CLI#sheet (method)">#sheet</a></span>
|
105
125
|
|
106
126
|
<small>TimelineSetter::CLI</small>
|
@@ -108,7 +128,7 @@
|
|
108
128
|
</li>
|
109
129
|
|
110
130
|
|
111
|
-
<li class="
|
131
|
+
<li class="r2 ">
|
112
132
|
<span class='object_link'><a href="TimelineSetter/Timeline.html#timeline-instance_method" title="TimelineSetter::Timeline#timeline (method)">#timeline</a></span>
|
113
133
|
|
114
134
|
<small>TimelineSetter::Timeline</small>
|
@@ -116,7 +136,7 @@
|
|
116
136
|
</li>
|
117
137
|
|
118
138
|
|
119
|
-
<li class="
|
139
|
+
<li class="r1 ">
|
120
140
|
<span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_markup-instance_method" title="TimelineSetter::Timeline#timeline_markup (method)">#timeline_markup</a></span>
|
121
141
|
|
122
142
|
<small>TimelineSetter::Timeline</small>
|
@@ -124,7 +144,7 @@
|
|
124
144
|
</li>
|
125
145
|
|
126
146
|
|
127
|
-
<li class="
|
147
|
+
<li class="r2 ">
|
128
148
|
<span class='object_link'><a href="TimelineSetter/Timeline.html#timeline_min-instance_method" title="TimelineSetter::Timeline#timeline_min (method)">#timeline_min</a></span>
|
129
149
|
|
130
150
|
<small>TimelineSetter::Timeline</small>
|
@@ -132,7 +152,7 @@
|
|
132
152
|
</li>
|
133
153
|
|
134
154
|
|
135
|
-
<li class="
|
155
|
+
<li class="r1 ">
|
136
156
|
<span class='object_link'><a href="TimelineSetter/CLI.html#timeline_page_path-instance_method" title="TimelineSetter::CLI#timeline_page_path (method)">#timeline_page_path</a></span>
|
137
157
|
|
138
158
|
<small>TimelineSetter::CLI</small>
|
@@ -140,7 +160,7 @@
|
|
140
160
|
</li>
|
141
161
|
|
142
162
|
|
143
|
-
<li class="
|
163
|
+
<li class="r2 ">
|
144
164
|
<span class='object_link'><a href="TimelineSetter/Timeline.html#tmpl-instance_method" title="TimelineSetter::Timeline#tmpl (method)">#tmpl</a></span>
|
145
165
|
|
146
166
|
<small>TimelineSetter::Timeline</small>
|
@@ -148,7 +168,7 @@
|
|
148
168
|
</li>
|
149
169
|
|
150
170
|
|
151
|
-
<li class="
|
171
|
+
<li class="r1 ">
|
152
172
|
<span class='object_link'><a href="TimelineSetter/Timeline.html#to_json-instance_method" title="TimelineSetter::Timeline#to_json (method)">#to_json</a></span>
|
153
173
|
|
154
174
|
<small>TimelineSetter::Timeline</small>
|
@@ -160,4 +180,3 @@
|
|
160
180
|
</div>
|
161
181
|
</body>
|
162
182
|
</html>
|
163
|
-
|
@@ -3,16 +3,26 @@
|
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
|
8
|
-
|
6
|
+
<title>
|
7
|
+
Top Level Namespace
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
9
16
|
|
10
17
|
<script type="text/javascript" charset="utf-8">
|
11
18
|
relpath = '';
|
12
19
|
if (relpath != '') relpath += '/';
|
13
20
|
</script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="js/
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
16
26
|
|
17
27
|
</head>
|
18
28
|
<body>
|
@@ -33,11 +43,14 @@
|
|
33
43
|
</div>
|
34
44
|
|
35
45
|
<div id="search">
|
36
|
-
|
37
|
-
|
38
|
-
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
39
53
|
</div>
|
40
|
-
|
41
54
|
<div class="clear"></div>
|
42
55
|
</div>
|
43
56
|
|
@@ -76,12 +89,14 @@
|
|
76
89
|
|
77
90
|
|
78
91
|
|
92
|
+
|
93
|
+
|
79
94
|
</div>
|
80
95
|
|
81
96
|
<div id="footer">
|
82
|
-
Generated on
|
97
|
+
Generated on Wed Nov 2 15:20:08 2011 by
|
83
98
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
84
|
-
0.
|
99
|
+
0.7.2 (ruby-1.8.7).
|
85
100
|
</div>
|
86
101
|
|
87
102
|
</body>
|
data/index.html
CHANGED
@@ -82,7 +82,7 @@
|
|
82
82
|
</head>
|
83
83
|
<body>
|
84
84
|
<a href="http://www.propublica.org" class="propublica"> </a>
|
85
|
-
<h1>TimelineSetter 0.
|
85
|
+
<h1>TimelineSetter 0.3.0</h1>
|
86
86
|
|
87
87
|
<p>TimelineSetter creates beautiful timelines.</p>
|
88
88
|
|
@@ -167,9 +167,10 @@ supporting assets if applicable) within the current directory.</p>
|
|
167
167
|
<ul>
|
168
168
|
<li><code>-c CSV</code> Path to your CSV file.</li>
|
169
169
|
<li><code>-o OUTPUT_PATH</code> Path to output timeline and assets. If absent, timeline will be created in current directory.</li>
|
170
|
-
<li><code>-a</code>
|
170
|
+
<li><code>-a</code> Do not output supporting assets such as CSS and JavaScript. This is useful if you’re customizing those and don’t want your versions clobbered.</li>
|
171
171
|
<li><code>-m</code> Create a minified one-page version of your timeline with all supporting assets inline.</li>
|
172
172
|
<li><code>-O</code> Open a browser to your new timeline after it is generated (currently Mac OS only).</li>
|
173
|
+
<li><code>-i</code> Add a custom interval for background “interval notches.” These take the format of JavaScript date <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date#Methods">getter methods</a>. For example, year would be <code>FullYear.</code> All the options are available <a href="#interval_notch_options">below</a>. If absent, TimelineSetter will attempt to automatically create interval notches based on the first and last dates in your timeline.</li>
|
173
174
|
<li><code>-h</code> Print help to standard output.</li>
|
174
175
|
</ul>
|
175
176
|
|
@@ -264,6 +265,25 @@ to point to their appropriate destinations.</p>
|
|
264
265
|
periods of time, and <em>event notches</em>, which, when clicked, reveal their
|
265
266
|
associated <em>event cards</em>.</p>
|
266
267
|
|
268
|
+
<p><a id="configuring"></a></p>
|
269
|
+
|
270
|
+
<h2>Configuring the Timeline JavaScript Embed</h2>
|
271
|
+
|
272
|
+
<p>Although the <code>timeline-setter</code> command generates a JavaScript embed that prepopulates your data, you can also create this yourself by calling <code>TimelineSetter.timeline.boot</code> with an array of card objects, and a config object.</p>
|
273
|
+
|
274
|
+
<pre><code>var myTimeline = TimelineSetter.Timeline.boot([{card}...], {config})
|
275
|
+
</code></pre>
|
276
|
+
|
277
|
+
<p>The config object looks for <code>interval</code>, <code>container</code>, and <code>formatter</code> options.</p>
|
278
|
+
|
279
|
+
<p>The <code>interval</code> option takes an <a href="#interval_notch_options">interval</a> in the form of a JavaScript date getter. The <code>container</code> option allows you to inject the entire timeline into an element with the given selector. (By default this is <code>#timeline</code>). Finally, <code>formatter</code> is a way to format dates on the timeline’s interval notches. Write a formatter like so:</p>
|
280
|
+
|
281
|
+
<pre><code>formatter : function(d, defaults) {
|
282
|
+
defaults.months = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
|
283
|
+
return defaults;
|
284
|
+
}
|
285
|
+
</code></pre>
|
286
|
+
|
267
287
|
<p><a name="styling"></a></p>
|
268
288
|
|
269
289
|
<h2>Styling Your Timeline</h2>
|
@@ -277,17 +297,14 @@ replace it completely. Here’s a guide to do that.</p>
|
|
277
297
|
|
278
298
|
<h3>Overview and Styling the Container and Top Matter</h3>
|
279
299
|
|
280
|
-
<p>All TimelineSetter CSS is scoped within a namespace starting with <code>TS
|
281
|
-
outermost container is <code>#timeline_setter.</code></p>
|
300
|
+
<p>All TimelineSetter CSS is scoped within a namespace starting with <code>TS</code> except for the outermost container (by default <code>#timeline</code>.) The container is configurable with the <code>container</code> argument in the TimelineSetter boot function’s config object.</p>
|
282
301
|
|
283
302
|
<p>Upon first glance, it may not seem like there is much markup at all. That’s
|
284
303
|
because we make extensive use of JavaScript (ERB-style) templating via
|
285
|
-
<a href="http://documentcloud.github.com/underscore/#template">Underscore.js</a> —
|
286
|
-
templates for each part of the timeline reside in the
|
287
|
-
in/out, previous/next buttons) are available within <code>#TS-top_matter_container .TS-controls</code>.</p>
|
304
|
+
<a href="http://documentcloud.github.com/underscore/#template">Underscore.js</a> —
|
305
|
+
templates for each part of the timeline reside in a JST object at the end of timeline-setter.js.</p>
|
288
306
|
|
289
|
-
<p>
|
290
|
-
via <code>script#TS-notch_tmpl</code>. Currently, series colors are hard coded in the
|
307
|
+
<p>Currently, series colors are hard coded in the
|
291
308
|
JavaScript. We support a maximum of nine series colors (assigned in this order:
|
292
309
|
<code>#065718, #EDC047, #91ADD1, #929E5E, #9E5E23, #C44846, #465363, #EDD4A5, #CECECE</code>,
|
293
310
|
they can be overridden in the “color priority” section of <code>timeline-setter.css</code>). Technically
|
@@ -298,10 +315,7 @@ to the default charcoal notch color.</p>
|
|
298
315
|
|
299
316
|
<h3>Styling the bar, notches and cards</h3>
|
300
317
|
|
301
|
-
<p>
|
302
|
-
position is based on the interval of time between events as automatically
|
303
|
-
determined by the JavaScript. Here’s a sampling of what you might see in
|
304
|
-
interval notches:</p>
|
318
|
+
<p>The position of interval notches is based on the interval of time between events as automatically determined by the JavaScript. Here’s a sampling of what you might see in interval notches:</p>
|
305
319
|
|
306
320
|
<pre><code>year => 2001
|
307
321
|
month => June, 2004
|
@@ -310,12 +324,58 @@ hour/minute => 11:59
|
|
310
324
|
second => 11:59:22
|
311
325
|
</code></pre>
|
312
326
|
|
313
|
-
<p
|
314
|
-
|
315
|
-
|
316
|
-
<code
|
317
|
-
|
318
|
-
|
327
|
+
<p><a id="interval_notch_options"></a>
|
328
|
+
The interval notches date spans themselves can be customized by using the <code>-i</code> flag when generating a timeline. The available parameters are</p>
|
329
|
+
|
330
|
+
<pre><code>Decade
|
331
|
+
Lustrum
|
332
|
+
FullYear
|
333
|
+
Month
|
334
|
+
Week
|
335
|
+
Date
|
336
|
+
Hours
|
337
|
+
Minutes
|
338
|
+
Seconds
|
339
|
+
</code></pre>
|
340
|
+
|
341
|
+
<p><a id="js_api"></a></p>
|
342
|
+
|
343
|
+
<h2>The JavaScript API</h2>
|
344
|
+
|
345
|
+
<p>As of version 0.3.0, TimelineSetter has a JavaScript API that allows programmatic access to certain events, and the ability to activate cards. To use the API, assign the <code>TimelineSetter.Timeline.boot()</code> function to a variable, and then use methods in the <code>api</code> object like so:</p>
|
346
|
+
|
347
|
+
<pre><code>var currentTimeline = TimelineSetter.Timeline.boot(options);
|
348
|
+
currentTimeline.api.onLoad(function() {
|
349
|
+
console.log("I'm ready")
|
350
|
+
});
|
351
|
+
</code></pre>
|
352
|
+
|
353
|
+
<p>Here are the API methods:</p>
|
354
|
+
|
355
|
+
<h3>onLoad</h3>
|
356
|
+
|
357
|
+
<p>Register a callback for when the timeline is loaded.</p>
|
358
|
+
|
359
|
+
<h3>onCardAdd</h3>
|
360
|
+
|
361
|
+
<p>Register a callback for when a card is added to the timeline. This method has access to the event name and the card object.</p>
|
362
|
+
|
363
|
+
<pre><code>currentTimeline.api.onCardAdd(function(evtName, obj) {
|
364
|
+
console.log(obj);
|
365
|
+
});
|
366
|
+
</code></pre>
|
367
|
+
|
368
|
+
<h3>onCardActivate</h3>
|
369
|
+
|
370
|
+
<p>Register a callback for when a card is activated (i.e. shown). This method has access to the event name and the card object.</p>
|
371
|
+
|
372
|
+
<h3>onBarMove</h3>
|
373
|
+
|
374
|
+
<p>Register a callback for when the bar is moved or zoomed. Be careful with this one: Bar move events can be fast and furious, especially with scroll wheels in Safari.</p>
|
375
|
+
|
376
|
+
<h3>activateCard</h3>
|
377
|
+
|
378
|
+
<p>Show the card matching a given timestamp. Right now, timelines only support one card per timestamp.</p>
|
319
379
|
|
320
380
|
<p><a id="roadmap"></a></p>
|
321
381
|
|
@@ -366,6 +426,27 @@ questions should go to <a href="mailto:opensource@propublica.org">opensource@pro
|
|
366
426
|
|
367
427
|
<h2>Change Log</h2>
|
368
428
|
|
429
|
+
<p><a id="release-030"></a></p>
|
430
|
+
|
431
|
+
<h3>0.3.0</h3>
|
432
|
+
|
433
|
+
<ul>
|
434
|
+
<li>Add JavaScript API</li>
|
435
|
+
<li>Scope timeline to a given element to support multiple timelines on a page</li>
|
436
|
+
<li>Add date formatter config option. <em>Thanks <a href="https://github.com/propublica/timeline-setter/pull/26">@omega</a></em></li>
|
437
|
+
</ul>
|
438
|
+
|
439
|
+
|
440
|
+
<p><a id="release-020"></a></p>
|
441
|
+
|
442
|
+
<h3>0.2.0</h3>
|
443
|
+
|
444
|
+
<ul>
|
445
|
+
<li>New feature adds support for custom interval notch ranges.</li>
|
446
|
+
<li>Change command line to output supporting assets by default unless <code>-a</code> is specified</li>
|
447
|
+
</ul>
|
448
|
+
|
449
|
+
|
369
450
|
<p><a id="release-012"></a></p>
|
370
451
|
|
371
452
|
<h3>0.1.2</h3>
|
data/lib/timeline_setter/cli.rb
CHANGED
@@ -77,6 +77,8 @@ module TimelineSetter
|
|
77
77
|
def compile!
|
78
78
|
if !@options[:no_assets] || !@options[:min]
|
79
79
|
FileUtils.cp_r(Dir.glob("#{TimelineSetter::ROOT}/public/*"), outdir)
|
80
|
+
# Concatenate JSTs to timeline-setter.js and remove templates.js
|
81
|
+
`cat #{outdir}/javascripts/templates.js >> #{outdir}/javascripts/timeline-setter.js && rm -rf #{outdir}/javascripts/templates*`
|
80
82
|
end
|
81
83
|
|
82
84
|
File.open(timeline_page_path, 'w+') do |doc|
|
@@ -15,8 +15,11 @@ module TimelineSetter
|
|
15
15
|
@events.to_json
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
{
|
18
|
+
def config_json
|
19
|
+
{
|
20
|
+
"interval" => "#{@interval}",
|
21
|
+
"container" => "#timeline"
|
22
|
+
}.to_json
|
20
23
|
end
|
21
24
|
|
22
25
|
def timeline_markup
|
@@ -38,7 +41,7 @@ module TimelineSetter
|
|
38
41
|
libs = Dir.glob("#{TimelineSetter::ROOT}/public/javascripts/vendor/**")
|
39
42
|
libs.each { |lib| @js << File.open(lib,'r').read }
|
40
43
|
@min_html = Kompress::HTML.new(timeline_markup).html
|
41
|
-
@js <<
|
44
|
+
@js << File.open("#{TimelineSetter::ROOT}/public/javascripts/timeline-setter.min.js", 'r').read
|
42
45
|
@timeline = tmpl("timeline-min.erb")
|
43
46
|
end
|
44
47
|
|
data/lib/timeline_setter.rb
CHANGED
@@ -10,13 +10,6 @@ require 'table_fu'
|
|
10
10
|
require 'json'
|
11
11
|
require 'kompress'
|
12
12
|
|
13
|
-
begin
|
14
|
-
require 'closure-compiler'
|
15
|
-
rescue LoadError
|
16
|
-
puts "== Warning, the closure-compiler gem is required to generate minified timelines"
|
17
|
-
end
|
18
|
-
|
19
|
-
|
20
13
|
require "#{TimelineSetter::ROOT}/lib/timeline_setter/version"
|
21
14
|
require "#{TimelineSetter::ROOT}/lib/timeline_setter/parser"
|
22
15
|
require "#{TimelineSetter::ROOT}/lib/timeline_setter/timeline"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div class="TS-card_container TS-card_container_<%= (card.get("series") || "").replace(/\W/g, "") %>">
|
2
|
+
<div class="TS-css_arrow TS-css_arrow_up TS-css_arrow_color_<%= card.get("topcolor") %>"></div>
|
3
|
+
<div class="TS-item TS-item_color_<%= card.get("topcolor") %>" data-timestamp="<%= card.get("timestamp") %>">
|
4
|
+
<div class="TS-item_label">
|
5
|
+
<% if (!_.isEmpty(card.get("html"))){ %>
|
6
|
+
<div class="TS-item_user_html">
|
7
|
+
<%= card.get("html") %>
|
8
|
+
</div>
|
9
|
+
<% } %>
|
10
|
+
<%= card.get("description") %>
|
11
|
+
</div>
|
12
|
+
<% if (!_.isEmpty(card.get("link"))){ %>
|
13
|
+
<a class="TS-read_btn" target="_blank" href="<%= card.get("link") %>">Read More</a>
|
14
|
+
<% } %>
|
15
|
+
|
16
|
+
<div class="TS-item_year">
|
17
|
+
<span class="TS-item_year_text"><%= (card.get("display_date") || "").length > 0 ? card.get("display_date") : card.get("date") %></span>
|
18
|
+
<div class="TS-permalink">∞</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div class="TS-notch TS-notch_<%= timestamp %> TS-notch_<%= series.replace(/\W/g, "") %> TS-notch_color_<%= topcolor %>"></div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="timeline_setter">
|
2
|
+
<div class="TS-top_matter_container">
|
3
|
+
<div class="TS-controls">
|
4
|
+
<a href="#" class="TS-zoom TS-zoom_in"><span class="TS-controls_inner_text TS-zoom_inner_text">+</span></a>
|
5
|
+
<a href="#" class="TS-zoom TS-zoom_out"><span class="TS-controls_inner_text TS-zoom_inner_text">-</span></a>
|
6
|
+
|
7
|
+
<a href="#" class="TS-choose TS-choose_prev">« <span class="TS-controls_inner_text">Previous</span></a>
|
8
|
+
<a href="#" class="TS-choose TS-choose_next"><span class="TS-controls_inner_text">Next</span> »</a>
|
9
|
+
</div>
|
10
|
+
<div class="TS-series_nav_container"></div>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="TS-notchbar_container">
|
14
|
+
<div class="TS-notchbar"></div>
|
15
|
+
</div>
|
16
|
+
<div class="TS-card_scroller">
|
17
|
+
<div class="TS-card_scroller_inner">
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
(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">∞</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 %>"> </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 \n <a href="#" class="TS-choose TS-choose_prev">« <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> »</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')})();
|