Skip to content

Commit 1a3d53c

Browse files
author
Kim Neunert
committed
refactored and moved to a template as described in tutorial
1 parent a406068 commit 1a3d53c

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

main.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
2+
Deployments = new Meteor.Collection("deployments");
33

44
if (Meteor.isServer) {
5-
Deployments = new Meteor.Collection("deployments");
5+
66
Meteor.startup(function () {
77
if (Deployments.find().count() === 0) {
88
Meteor.http.get("http://localhost:3000/deployments.json", function(error,results){
@@ -45,7 +45,12 @@ if (Meteor.isClient) {
4545
}
4646
});
4747
*/
48-
Meteor.startup( function() {
48+
49+
// Many of this stuff is copied from
50+
// http://www.benmcmahen.com/blog/posts/50eb57d55a94d35262000001
51+
Template.map.rendered = function() {
52+
// copied ... reason?!
53+
this.node = this.find('#video-map');
4954

5055
var margin = {top: 10, right: 10, bottom: 100, left: 180},
5156
margin2 = {top: 430, right: 10, bottom: 20, left: 180},
@@ -101,6 +106,7 @@ if (Meteor.isClient) {
101106
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");
102107

103108
d3.json("/deployments.json", function(data) {
109+
104110
var i = 1;
105111
var myServerHash= {};
106112
data.forEach(function(d) {
@@ -183,7 +189,7 @@ if (Meteor.isClient) {
183189

184190

185191

186-
});
192+
}
187193

188194

189195

meteor-deployments.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
<body>
66
{{> hello}}
7+
{{> map}}
78
</body>
89

910

@@ -12,3 +13,17 @@
1213
<h1>Hello World!</h1>
1314
The second X-Axis is a brushing-area. So, brush it!!
1415
</template>
16+
17+
<template name='map'>
18+
<div class='timeline-wrapper'>
19+
{{#constant}}
20+
<svg id='video-map' width='100%' height='60'>
21+
<g class='map-wrap' transform = 'translate(0,60)'>
22+
<rect class='timeline-click-zone' y='-60' height='60'></rect>
23+
<g class='caption-spans'></g>
24+
<line id='current-position' y1='0' y2='-60'></line>
25+
</g>
26+
</svg>
27+
{{/constant}}
28+
</div>
29+
</template>

0 commit comments

Comments
 (0)