From 249275bc0a658f4ab06876b8c645f8bbc3138423 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 31 May 2014 19:19:36 +0200 Subject: [PATCH] Configuration for the client. --- app/index.html | 7 ++----- app/scripts/app.js | 5 +++-- app/scripts/config.js | 21 +++++++++++++++++++++ app/scripts/controllers/main.js | 4 +++- app/scripts/controllers/newNodeCtrl.js | 4 +++- app/scripts/controllers/updateNodeCtrl.js | 3 ++- app/scripts/directives/navbar.js | 3 ++- app/scripts/directives/nodeForm.js | 9 +++++---- app/views/directives/navbar.html | 2 +- app/views/directives/nodeForm.html | 9 ++++----- app/views/main.html | 4 ++-- app/views/newNodeForm.html | 4 ++-- app/views/updateNodeForm.html | 6 +++--- 13 files changed, 53 insertions(+), 28 deletions(-) create mode 100644 app/scripts/config.js diff --git a/app/index.html b/app/index.html index e7f883c..7ddeffc 100644 --- a/app/index.html +++ b/app/index.html @@ -4,7 +4,7 @@ - Knotenverwaltung + Knotenverwaltung @@ -19,10 +19,6 @@ - -
@@ -44,6 +40,7 @@ + diff --git a/app/scripts/app.js b/app/scripts/app.js index 76209bc..ecaf090 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -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; }); -}]); +}); diff --git a/app/scripts/config.js b/app/scripts/config.js new file mode 100644 index 0000000..a3f43b5 --- /dev/null +++ b/app/scripts/config.js @@ -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 + } + }; +}); diff --git a/app/scripts/controllers/main.js b/app/scripts/controllers/main.js index 3c5e2a5..a845ca2 100644 --- a/app/scripts/controllers/main.js +++ b/app/scripts/controllers/main.js @@ -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(); }; diff --git a/app/scripts/controllers/newNodeCtrl.js b/app/scripts/controllers/newNodeCtrl.js index 664b569..ec7de24 100644 --- a/app/scripts/controllers/newNodeCtrl.js +++ b/app/scripts/controllers/newNodeCtrl.js @@ -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; diff --git a/app/scripts/controllers/updateNodeCtrl.js b/app/scripts/controllers/updateNodeCtrl.js index 78d874f..a84b1c5 100644 --- a/app/scripts/controllers/updateNodeCtrl.js +++ b/app/scripts/controllers/updateNodeCtrl.js @@ -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; diff --git a/app/scripts/directives/navbar.js b/app/scripts/directives/navbar.js index 497f332..71aa59a 100644 --- a/app/scripts/directives/navbar.js +++ b/app/scripts/directives/navbar.js @@ -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(); }; diff --git a/app/scripts/directives/nodeForm.js b/app/scripts/directives/nodeForm.js index 34961cb..db7db32 100644 --- a/app/scripts/directives/nodeForm.js +++ b/app/scripts/directives/nodeForm.js @@ -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: { diff --git a/app/views/directives/navbar.html b/app/views/directives/navbar.html index 5ec7eaa..e322735 100644 --- a/app/views/directives/navbar.html +++ b/app/views/directives/navbar.html @@ -1,7 +1,7 @@ diff --git a/app/views/directives/nodeForm.html b/app/views/directives/nodeForm.html index f673b5d..80ec75a 100644 --- a/app/views/directives/nodeForm.html +++ b/app/views/directives/nodeForm.html @@ -35,18 +35,17 @@

Wo soll Dein Router stehen?

-

Wenn Du möchtest, dass Dein Knoten an der richtigen Stelle auf der - Knotenkarte angezeigt wird, + Knotenkarte angezeigt wird, kannst Du seine Koordinaten hier eintragen. Klicke einfach in der auf dieser Seite angezeigten Karte an die Stelle, wo Dein Knoten erscheinen soll. Durch erneutes Klicken kannst Du die Position jederzeit anpassen.

- +
@@ -75,7 +74,7 @@