-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroutes.js
119 lines (111 loc) · 2.7 KB
/
routes.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
SiteController = RouteController.extend({
layoutTemplate: 'layout',
fastRender: true,
onAfterAction: function() {
if (!Meteor.isClient) {
return;
}
SEO.set({
title: orion.dictionary.get('seo.title'),
link: {
icon: orion.dictionary.get('seo.favIcon.url'),
},
meta: {
description: orion.dictionary.get('seo.description')
},
og: {
title: orion.dictionary.get('seo.title'),
description: orion.dictionary.get('seo.description'),
image: orion.dictionary.get('seo.image.url')
}
});
}
});
Router.route('/', {
name: 'home',
controller: 'SiteController'
});
Router.route('/work/:url', {
name: 'work.show',
controller: 'SiteController',
onAfterAction: function() {
if (!$('.work-show') || !$('.work-show').offset()) return;
$('html, body').animate({
scrollTop: ($('.work-show').offset().top - 120)
}, 500);
}
});
Router.route('/work/:url/:_id', {
name: 'work.image',
loadingTemplate: 'workImage',
fastRender: true,
waitOn: function() {
return Meteor.subscribe('work', this.params._id);
},
onAfterAction: function() {
if (!Meteor.isClient) {
return;
}
var work = Works.findOne({ _id: this.params._id });
if (!work) return;
SEO.set({
title: orion.dictionary.get('seo.title'),
link: {
icon: orion.dictionary.get('seo.favIcon.url'),
},
meta: {
description: work.description || orion.dictionary.get('seo.description')
},
og: {
title: orion.dictionary.get('seo.title'),
description: work.description || orion.dictionary.get('seo.description'),
image: work.image.url
}
});
}
});
Router.route('/clients', {
name: 'clients',
controller: 'SiteController'
});
Router.route('/publications', {
name: 'publications.index',
controller: 'SiteController'
});
Router.route('/publications/:_id', {
name: 'publications.top',
controller: 'SiteController'
});
Router.route('/publications-item/:_id', {
name: 'publications.show',
loadingTemplate: 'publicationsShow',
fastRender: true,
waitOn: function() {
return Meteor.subscribe('publication', this.params._id);
},
onAfterAction: function() {
if (!Meteor.isClient) {
return;
}
var publication = Publications.findOne({ _id: this.params._id });
if (!publication) return;
SEO.set({
title: orion.dictionary.get('seo.title'),
link: {
icon: orion.dictionary.get('seo.favIcon.url'),
},
meta: {
description: publication.description || orion.dictionary.get('seo.description')
},
og: {
title: orion.dictionary.get('seo.title'),
description: publication.description || orion.dictionary.get('seo.description'),
image: publication.image.url
}
});
}
});
Router.route('/bio', {
name: 'bio',
controller: 'SiteController'
});