forked from ethereum/ethereum.org
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrollers.js
137 lines (122 loc) · 3.26 KB
/
controllers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//TODO: modularise if this ever grows > 200 loc
if(Meteor.isClient){
$(window).load(function(){
Plugins.scrollTo($(window.location.hash));
});
}
AppController = RouteController.extend({
layoutTemplate: "appLayout",
onAfterAction: function(){
var h = window.location.hash;
if(h){
Plugins.scrollTo($(h));
}else{
window.scrollTo(0,0);
}
},
action: function(){
throw new Error("action: override me!");
}
});
HomeController = AppController.extend({
subscriptions: function(){
this.subscribe("meetups");
this.subscribe("youtubeVideos");
this.subscribe("feed_entries");
this.subscribe("featuredProjects");
this.subscribe("featuredIn");
this.subscribe("pressReleases");
this.subscribe("blurboids");
},
data: function(){
return {
featuredMeetups: Meetups.find({featured: true}),
meetups: Meetups.find(),
youtubeVideos: YoutubeVideos.find({},{limit:9, sort: {pubDate: -1}}),
blogFeed: FeedEntries.find({feed_category: "Blog"}, {limit: 3, sort: {pubdate: -1}}),
tweets: FeedEntries.find({feed_category: "Twitter"}, {limit: 15, sort: {pubdate: -1}}),
press: PressReleases.find({}, {fields: {body: 0},limit: 20, sort: {publishedAt: -1}}),
projectGroups: groupByRows(FeaturedProjects.find().fetch(), 4),
featuredIn: FeaturedIn.find().fetch(),
augmentingNav: true
};
},
action: function(){
this.render("homePage");
}
});
TeamController = AppController.extend({
// team collections are always published (due to yogiben's admin being an utter shit)
action: function(){
this.render("teamPage");
},
data: function(){
return {
profiles: _.map(lodash.shuffle(TeamProfiles.find().fetch()), function(p, i){
return {
profile: p,
index: i
};
})
};
}
});
PressController = AppController.extend({
subscriptions: function(){
this.subscribe("feed_entries");
this.subscribe("pressReleases");
},
action: function(){
this.render("pressPage");
},
data: function(){
return {
blogFeed: FeedEntries.find({feed_category: "Blog"}, {
limit: 3,
sort: {pubdate: -1},
fields: {
summary: 0
}
}),
tweets: FeedEntries.find({feed_category: "Twitter"}, {limit: 5, sort: {pubdate: -1}}),
press: PressReleases.find({}, {limit: 20, sort: {publishedAt: -1}})
};
}
});
PartnershipController = AppController.extend({
action: function(){
this.render("partnershipPage");
}
});
MiningController = AppController.extend({
action: function(){
this.render("miningPage");
}
});
FoundationController = AppController.extend({
action: function(){
this.render("foundationPage");
}
});
EtherController = AppController.extend({
action: function(){
this.render("etherPage");
}
});
CompanyStructureController = AppController.extend({
action: function(){
this.render("companyStructurePage");
}
});
LicensingController = AppController.extend({
action: function(){
this.render("licensingPage");
}
});
function groupByRows(items, perRow){
return _.reduce(items, function(groups, item, i){
var groupI = Math.floor(i / perRow);
(groups[groupI] = groups[groupI] || []).push(item);
return groups;
}, []);
}