This repository has been archived by the owner on Mar 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
67 lines (57 loc) · 1.71 KB
/
index.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
import angular from 'angular';
// Import our modules
import {angularNavbarModule} from './modules/navbar/index';
import 'angular-ui-router';
// Import our configs
import routesConfig from './routes';
// Import our services
import Sayonara from './app/services/sayonara';
// Import our components
import {main} from './app/components/main/main';
import {entry} from './app/components/entry/entry';
import {page} from './app/components/page/page';
import './index.scss';
angular
.module('app', [angularNavbarModule, 'ui.router'])
.config(routesConfig)
.service('sayonaraService', Sayonara)
.run(($log, $timeout, sayonaraService, navbarRouteService) => {
/** @ngInject */
// Start polling for the site
sayonaraService.getSite().then(response => {
$timeout(() => {
navbarRouteService.setTitle(response.siteName, {
title: 'Home',
state: 'app',
url: '/'
});
// Create our routes from our pages
const navbarRoutes = [];
response.pages.forEach((page, index) => {
if (index === 0) {
navbarRoutes.push({
title: page.title,
state: 'app',
url: '/'
});
} else {
navbarRoutes.push({
title: page.title,
state: 'page',
stateParams: {
title: page.title
},
url: '/page/' + page.title
});
}
});
// Set the routes
navbarRouteService.setRoutes(navbarRoutes);
}, 0);
});
// Set up our nav
// navbarRouteService.enableAlwaysDesktop();
})
.component('app', main)
.component('entry', entry)
.component('page', page);