-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
executable file
·103 lines (91 loc) · 3.55 KB
/
app.js
File metadata and controls
executable file
·103 lines (91 loc) · 3.55 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
angular.module('map', ['map.controllers', 'map.services', 'map.filters', 'leaflet-directive']);
angular.module('common', ['common.filters', 'common.controllers', 'common.services']);
app = angular.module('unisson_map', ['common', 'map', 'ui.router', 'ngAnimate', 'googleOauth', 'angular-unisson-auth']);
// Config
app.constant('moduleTemplateBaseUrl', config.templateBaseUrl + 'map/');
app.config(['TokenProvider', '$locationProvider', function(TokenProvider, $locationProvider) {
TokenProvider.extendConfig({
clientId: '645581170749.apps.googleusercontent.com',
redirectUri: 'http://localhost:8080/oauth2callback.html',
scopes: ["https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"],
});
}])
app.config(function(RestangularProvider) {
RestangularProvider.setBaseUrl("http://localhost:8000/api/v0");
//RestangularProvider.setBaseUrl("http://api.gup.extra-muros.coop/api/v0");
/* Tastypie patch */
RestangularProvider.setResponseExtractor(function(response, operation, what, url) {
var newResponse;
if (operation === "getList") {
newResponse = response.objects;
newResponse.metadata = response.meta;
} else {
newResponse = response;
}
return newResponse;
});
});
app.config(['$locationProvider', '$stateProvider', '$urlRouterProvider', 'moduleTemplateBaseUrl',
function($locationProvider, $stateProvider, $urlRouterProvider, moduleTemplateBaseUrl) {
$locationProvider.html5Mode(false);
$urlRouterProvider.otherwise("/")
$stateProvider
.state('index', {
url: '/',
controller: 'MapNewCtrl',
page_title: 'Bienvenue',
templateUrl: moduleTemplateBaseUrl + 'map_new.html',
})
.state('index.my_maps', {
url: '/my_maps',
templateUrl: moduleTemplateBaseUrl + 'map_mymaps.html',
})
.state('map', {
url: '/:slug',
templateUrl: moduleTemplateBaseUrl + 'map_detail.html',
controller: 'MapDetailCtrl'
})
.state('map.welcome', {
url: '/welcome',
templateUrl: moduleTemplateBaseUrl + 'map_welcome.html'
})
.state('map.search', {
url: '/search',
templateUrl: moduleTemplateBaseUrl + 'map_search.html',
controller: 'MapSearchCtrl'
})
.state('map.marker_new', {
url: '/marker/new',
templateUrl: moduleTemplateBaseUrl + 'marker_new.html',
controller: 'MapMarkerNewCtrl'
})
.state('map.layers', {
url: '/layers',
templateUrl: moduleTemplateBaseUrl + 'map_layers.html',
})
.state('map.share', {
url: '/share',
templateUrl: moduleTemplateBaseUrl + 'map_share.html',
})
.state('map.my_maps', {
url: '/my_maps',
templateUrl: moduleTemplateBaseUrl + 'map_mymaps.html',
})
.state('map.marker_detail', {
url: '/marker/:markerId',
templateUrl: moduleTemplateBaseUrl + 'marker_detail.html',
controller: 'MapMarkerDetailCtrl'
});
}
]);
app.run(['$rootScope', function($rootScope) {
$rootScope.MEDIA_URI = 'http://localhost:8000';
$rootScope.CONFIG = config;
$rootScope.loginBaseUrl = config.loginBaseUrl;
$rootScope.homeStateName = config.homeStateName;
$rootScope.$on('$stateChangeSuccess', function (event, current, previous) {
if ( current.page_title )
$rootScope.page_title = current.page_title;
});
}]);