-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
89 lines (68 loc) · 2.53 KB
/
Copy pathapp.js
File metadata and controls
89 lines (68 loc) · 2.53 KB
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
// (function() {
var app = angular.module('coinrightnow', ['ngRoute','ui.bootstrap','angularUtils.directives.dirDisqus','ui.tinymce']);
app.value('lang', 'EN');
app.config(['$routeProvider','$locationProvider',function($routeProvider,$locationProvider){
$routeProvider.
when('/home',{
templateUrl : 'Templates/HomeTemplate.html',
controller:'MainController',
}).
when('/menu',{
templateUrl : 'Templates/Menu.html',
controller:'MainController',
}).
when('/locations',{
templateUrl : 'Templates/Locations.html',
controller:'MainController',
}).
when('/login',{
templateUrl : 'Templates/LoginTemplate.html',
controller:'loginCtrl',
controllerAs: 'vm',
}).
when('/admin',{
templateUrl : 'Templates/AdminTemplate.html',
controller:'AdminController',
}).
when('/coin/:id',{
templateUrl : 'Templates/CoinTemplate.html',
controller: 'CoinController',
}).
when('/article/:id',{
templateUrl :'Templates/ArticleTemplate.html',
controller: 'ArticleController',
}).
when('/createarticle',{
templateUrl :'Templates/Forms/ArticleForm.html',
controller: 'ArticleController',
}).
otherwise({
redirectTo: '/home'
});
}]);
app.config(['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode(true);
}]);
angular.module('coinrightnow').run(['$rootScope', '$location', 'authentication', function ($rootScope, $location, authentication) {
$rootScope.$on('$routeChangeStart', function (event) {
if ($location.path() === '/login' && authentication.isLoggedIn()) {
$location.path('/');
}
if (($location.path() === '/admin' || $location.path() ==='/createarticle' ) && !authentication.isLoggedIn()) {
$location.path('/');
}
});
}]);
/* particlesJS.load(@dom-id, @path-json, @callback (optional)); */
particlesJS.load('particles-js', 'bower_components/constellation/particles.json', function() {
console.log('callback - particles.js config loaded');
});
String.prototype.trunc = String.prototype.trunc ||
function(n){
// this will return a substring and
// if its larger than 'n' then truncate and append '...' to the string and return it.
// if its less than 'n' then return the 'string'
return this.length>n ? this.substr(0,n-1)+'...' : this.toString();
};
export default app;
// }());