diff --git a/app/data/default_config.json b/app/data/default_config.json index 3ef813d..1e0f17e 100644 --- a/app/data/default_config.json +++ b/app/data/default_config.json @@ -3,8 +3,14 @@ "auth_service": "google", "username": "YOUR_USERNAME", "password": "YOUR_PASSWORD", - "location": "52.39037297896968,4.828920364379883", + "location": "", + "favorite_locations":[ + {"name": "Default", "coords": "52.39037297896968,4.828920364379883"} + ], "gmapkey": "GOOGLE_MAPS_API_KEY", + "encrypt_location": "", + "telegram_token": "", + "discord_token": "", "tasks": [ { "type": "HandleSoftBan" diff --git a/app/index.html b/app/index.html index cfce754..ae7fd15 100644 --- a/app/index.html +++ b/app/index.html @@ -22,28 +22,27 @@ your browser to improve your experience.

-
+ @@ -101,6 +102,7 @@ + @@ -108,9 +110,9 @@ + - @@ -120,8 +122,6 @@ - - diff --git a/app/scripts/app.js b/app/scripts/app.js index a2d4cfb..14aae4d 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -19,6 +19,10 @@ angular ]).config(function($routeProvider, $locationProvider) { $routeProvider .when('/', { + templateUrl: './views/auth_config.html', + controller: 'AuthCtrl as vm' + }) + .when('/general-config', { templateUrl: './views/general_config.html', controller: 'GeneralCtrl' }) @@ -52,4 +56,4 @@ angular }); }).run(function(editableOptions) { editableOptions.theme = 'bs3'; -}); \ No newline at end of file +}); diff --git a/app/scripts/controllers/auth.js b/app/scripts/controllers/auth.js new file mode 100644 index 0000000..6610a7e --- /dev/null +++ b/app/scripts/controllers/auth.js @@ -0,0 +1,85 @@ +(function() { + 'use strict'; + + angular.module('botConfApp') + .controller('AuthCtrl', AuthCtrl); + + AuthCtrl.$inject = ['$scope', 'NgMap']; + + /** + * @ngdoc function + * @name botConfApp.controller:AuthCtrl + * @description + * # AuthCtrl + * Controller of the botConfApp + */ + function AuthCtrl($scope, NgMap) { + var vm = this; + + vm.updateActiveLocationCoords = updateActiveLocationCoords; + vm.updateActiveLocationName = updateActiveLocationName; + vm.setActiveLocation = setActiveLocation; + vm.addLocation = addLocation; + vm.removeLocation = removeLocation; + + init(); + + function init() { + NgMap.getMap().then(function(map) { + vm.map = map; + }); + vm.setActiveLocation(0); + } + + function updateMap(coords) { + vm.mapLocation = coords; + }; + + function updateLocation(location) { + $scope.config.location = location; + }; + + function updateActiveLocationCoords(e) { + var coords; + + if (typeof e === 'number') { + if (e === vm.activeLocation) { + coords = $scope.config.favorite_locations[e].coords; + } + } else { + coords = e.latLng.lat() + ',' + e.latLng.lng(); + } + $scope.config.favorite_locations[vm.activeLocation].coords = coords; + updateMap(coords); + }; + + function updateActiveLocationName(i) { + if (i === vm.activeLocation) { + updateLocation($scope.config.favorite_locations[i].name); + } + }; + + function setActiveLocation(i) { + var location = $scope.config.favorite_locations[i]; + + vm.activeLocation = i; + updateMap(location.coords); + updateLocation(location.name); + } + + function addLocation() { + $scope.config.favorite_locations.push({ + "name": "New location", + "coords": "52.39037297896968,4.828920364379883" + }); + vm.setActiveLocation($scope.config.favorite_locations.length - 1); + } + + function removeLocation(i) { + if ($scope.config.favorite_locations.length > 1) { + $scope.config.favorite_locations.splice(i, 1); + vm.setActiveLocation($scope.config.favorite_locations.length - 1); + } + } + } +})(); diff --git a/app/scripts/controllers/general.js b/app/scripts/controllers/general.js index 09521a0..331e2f9 100644 --- a/app/scripts/controllers/general.js +++ b/app/scripts/controllers/general.js @@ -1,34 +1,19 @@ +(function() { 'use strict'; /** * @ngdoc function - * @name botConfApp.controller:GeneralctrlCtrl + * @name botConfApp.controller:GeneralCtrl * @description - * # GeneralctrlCtrl + * # GeneralCtrl * Controller of the botConfApp */ angular.module('botConfApp') - .controller('GeneralCtrl',['$scope', 'NgMap', function ($scope, NgMap) { - $scope.marker = null; - $scope.map_options = { - center: [-117.38061189651489, - 33.93955043249883] - }; + .controller('GeneralCtrl', GeneralCtrl); + GeneralCtrl.$inject = ['$scope']; - $scope.marker = {}; - $scope.placeMarker = function (event) { - $scope.marker = {lat: event.latLng.lat(), lng: event.latLng.lng()}; - $scope.setCoords(event); - }; - - $scope.setCoords = function (event) { - if(event.latLng){ - $scope.config.location = event.latLng.lat() + ',' + event.latLng.lng(); - } - }; - - NgMap.getMap().then(function (map) { - $scope.map = map; - }); - }]); + function GeneralCtrl($scope) { + var vm = this; + }; +})(); diff --git a/app/views/auth_config.html b/app/views/auth_config.html new file mode 100644 index 0000000..6a85bd1 --- /dev/null +++ b/app/views/auth_config.html @@ -0,0 +1,125 @@ +
+
+

Auth info

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Auth type + +
Username + +
Password + +
Google Maps api key + + + Get one + + here + + +
Current start location + +
Encrypt location + +
Telegram Token + +
Discord Token + +
+
+
+

+ Favorite locations + + + Add location + + +

+

+ Click on the map to set your location +

+ + + + + + + + + + + + + + + +
ActiveNameLocation
+ + + + + + + +
+
+
diff --git a/app/views/general_config.html b/app/views/general_config.html index 2f76e15..6f26594 100644 --- a/app/views/general_config.html +++ b/app/views/general_config.html @@ -1,38 +1,7 @@
-
+

General info

- - - - - - - - - - - - - - - - -
Auth type - -
Username - -
Password - -
Google Maps api key - - Get one here -
Max steps @@ -85,14 +54,4 @@

General info

-
-

Select start location

- Click on the map to set your start location - - - -
- Current start location: {{config.location}} -
-
-
\ No newline at end of file +
diff --git a/app/views/tasks/EvolveAll.html b/app/views/tasks/EvolvePokemon.html similarity index 100% rename from app/views/tasks/EvolveAll.html rename to app/views/tasks/EvolvePokemon.html