Configuration for the client.

This commit is contained in:
Your Name 2014-05-31 19:19:36 +02:00
parent 637fd10606
commit 249275bc0a
13 changed files with 53 additions and 28 deletions

View file

@ -40,8 +40,9 @@ angular.module('ffffng', [
}
};
})
.run(['$location', '$rootScope', function ($location, $rootScope) {
.run(function ($location, $rootScope, config) {
$rootScope.$on('$routeChangeSuccess', function (event, current) {
$rootScope.title = current.$$route.title;
$rootScope.config = config;
});
}]);
});

21
app/scripts/config.js Normal file
View file

@ -0,0 +1,21 @@
'use strict';
angular.module('ffffng')
.factory('config', function () {
return {
community: {
name: 'Freifunk Hamburg',
domain: 'hamburg.freifunk.net',
contactEmail: 'kontakt@hamburg.freifunk.net'
},
map: {
graphUrl: 'http://graph.hamburg.freifunk.net/graph.html',
mapUrl: 'http://graph.hamburg.freifunk.net/geomap.html'
},
coordsSelector: {
lat: 53.565278,
lng: 10.001389,
defaultZoom: 10
}
};
});

View file

@ -1,7 +1,9 @@
'use strict';
angular.module('ffffng')
.controller('MainCtrl', function ($scope, Navigator) {
.controller('MainCtrl', function ($scope, Navigator, config) {
$scope.config = config;
$scope.newNode = function () {
Navigator.newNode();
};

View file

@ -1,7 +1,9 @@
'use strict';
angular.module('ffffng')
.controller('NewNodeCtrl', function ($scope, Navigator, NodeService, $routeParams, _) {
.controller('NewNodeCtrl', function ($scope, Navigator, NodeService, $routeParams, _, config) {
$scope.config = config;
$scope.node = {};
$scope.saved = false;

View file

@ -1,7 +1,8 @@
'use strict';
angular.module('ffffng')
.controller('UpdateNodeCtrl', function ($scope, Navigator, NodeService) {
.controller('UpdateNodeCtrl', function ($scope, Navigator, NodeService, config) {
$scope.config = config;
$scope.node = undefined;
$scope.token = undefined;
$scope.saved = false;

View file

@ -2,7 +2,8 @@
angular.module('ffffng')
.directive('fNavbar', function (Navigator) {
var ctrl = function ($scope) {
var ctrl = function ($scope, config) {
$scope.config = config;
$scope.goHome = function () {
Navigator.home();
};

View file

@ -2,12 +2,13 @@
angular.module('ffffng')
.directive('fNodeForm', function () {
var ctrl = function ($scope, $timeout, Constraints, Validator, _) {
var ctrl = function ($scope, $timeout, Constraints, Validator, _, config) {
$scope.config = config;
angular.extend($scope, {
center: {
lat: 53.565278,
lng: 10.001389,
zoom: 10
lat: config.coordsSelector.lat,
lng: config.coordsSelector.lng,
zoom: config.coordsSelector.defaultZoom
},
markers: {},
layers: {