From c20a283aeba97ee8b774d2575b76c95c87f6e568 Mon Sep 17 00:00:00 2001 From: Mark Cottman-Fields Date: Wed, 20 Nov 2013 16:56:47 +1000 Subject: [PATCH] More work on bird walk stuff. Fixed some problems with host/port and paths to assets. --- build.config.js | 11 +++++--- src/app/birdWalks/_birdWalks.scss | 4 +++ src/app/birdWalks/birdWalk.tpl.html | 11 +++++--- src/app/birdWalks/birdWalks.js | 38 +++++++++++++++++++++++++--- src/app/birdWalks/birdWalks.tpl.html | 6 ++--- src/baw.configuration.tpl.js | 5 ++-- src/components/services/services.js | 13 ++++++---- src/index.html | 4 +-- 8 files changed, 68 insertions(+), 24 deletions(-) diff --git a/build.config.js b/build.config.js index 73bae64c..a74d1d06 100644 --- a/build.config.js +++ b/build.config.js @@ -13,10 +13,13 @@ module.exports = { compile_dir: 'bin', build_configs: { + keys:{ + googleMaps: "" + }, configFile: appConfigFile, development: { apiRoot: "http://staging.ecosounds.org", - siteRoot: "localhost:8080", + siteRoot: "http://localhost:8080", siteDir: "/" }, staging: { @@ -25,9 +28,9 @@ module.exports = { siteDir: "/system/listen_to/" }, production: { - apiRoot: "http://ecosounds.org", - siteRoot: "http://ecosounds.org/????", - siteDir: "????" + apiRoot: "http://awb.ecosounds.org", + siteRoot: "http://awb.ecosounds.org/system/listen_to", + siteDir: "/system/listen_to/" }, current: {} diff --git a/src/app/birdWalks/_birdWalks.scss b/src/app/birdWalks/_birdWalks.scss index e69de29b..5eaef061 100644 --- a/src/app/birdWalks/_birdWalks.scss +++ b/src/app/birdWalks/_birdWalks.scss @@ -0,0 +1,4 @@ +#locationMap { + width: 100%; + height: 300px; +} \ No newline at end of file diff --git a/src/app/birdWalks/birdWalk.tpl.html b/src/app/birdWalks/birdWalk.tpl.html index 22c330d5..ca3c54bc 100644 --- a/src/app/birdWalks/birdWalk.tpl.html +++ b/src/app/birdWalks/birdWalk.tpl.html @@ -1,8 +1,11 @@
-{{params}} -
-
+

{{details.name}}

-{{spec.walks}} +

{{details.description}}

+ {{details.name}} + {{$parent.spec.birdWalkSpec.walks[params.birdWalkId]}} +
diff --git a/src/app/birdWalks/birdWalks.js b/src/app/birdWalks/birdWalks.js index 21edda44..188948d3 100644 --- a/src/app/birdWalks/birdWalks.js +++ b/src/app/birdWalks/birdWalks.js @@ -9,16 +9,46 @@ angular.module('bawApp.birdWalks', []) pageHit: (new Date()).toISOString() }; - $scope.imagesPath = paths.site.files.birdWalk.images; + $scope.imagesPath = paths.site.files.birdWalk.imagesAbsolute; // download bird walk specification - BirdWalkService.getUrl(paths.site.files.birdWalk.spec, 'birdWalkSpec', $scope); + BirdWalkService.getUrl(paths.site.files.birdWalk.specAbsolute, 'birdWalkSpec', $scope, null); + BirdWalkService.getUrl(paths.site.files.birdWalk.statsAbsolute, 'birdWalkStats', $scope, null); }]) .controller('BirdWalkCtrl', ['$scope', '$resource', '$routeParams', '$route', '$http', 'BirdWalkService', 'conf.paths', function BirdWalkCtrl($scope, $resource, $routeParams, $route, $http, BirdWalkService, paths) { - $scope.imagesPath = paths.site.files.birdWalk.images; - BirdWalkService.getUrl(paths.site.files.birdWalk.spec, 'birdWalkSpec', $scope); + + // constants + var CURRENT_LOCATION_ZOOM = 4; + + // initialise + $scope.imagesPath = paths.site.files.birdWalk.imagesAbsolute; $scope.params = $routeParams; + BirdWalkService.getUrl(paths.site.files.birdWalk.statsAbsolute, 'birdWalkStats', $scope, null); + BirdWalkService.getUrl(paths.site.files.birdWalk.specAbsolute, 'birdWalkSpec', $scope, function () { + // set up page display + $scope.details = $scope.spec.birdWalkSpec.walks[$scope.params.birdWalkId]; + var overviewLocation = new google.maps.LatLng( + $scope.details.overviewLocation.latitude, + $scope.details.overviewLocation.longitude); + + $scope.locationMap = $scope.createMap('locationMap', overviewLocation, CURRENT_LOCATION_ZOOM); + google.maps.event.trigger($scope.locationMap, 'resize'); + }); + //$scope.spec.birdWalkSpec.walks + + $scope.createMap = function (elementId, LatLng, zoom) { + return new google.maps.Map( + document.getElementById(elementId), + { + center: LatLng, + zoom: zoom, + mapTypeId: google.maps.MapTypeId.HYBRID + } + ); + }; + + }]); \ No newline at end of file diff --git a/src/app/birdWalks/birdWalks.tpl.html b/src/app/birdWalks/birdWalks.tpl.html index a0edaf16..279f6f9d 100644 --- a/src/app/birdWalks/birdWalks.tpl.html +++ b/src/app/birdWalks/birdWalks.tpl.html @@ -1,12 +1,12 @@
-
+
{{name}} + alt="{{walkSpec.name}}" class="img-responsive" title="{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].name}}">
-

{{name}} +

{{walkSpec.name}} {{walkSpec.waypoints.length}} waypoint(s)

{{walkSpec.description}}

diff --git a/src/baw.configuration.tpl.js b/src/baw.configuration.tpl.js index bf4f40fe..4a358d5a 100644 --- a/src/baw.configuration.tpl.js +++ b/src/baw.configuration.tpl.js @@ -56,8 +56,9 @@ angular.module('bawApp.configuration', []) birdWalk : { list: 'birdWalks/birdWalks.tpl.html', detail: 'birdWalks/birdWalk.tpl.html', - spec: '/assets/bird_walk/bird_walk_spec.json', - images: '/assets/bird_walk/images/' + spec: 'assets/bird_walk/bird_walk_spec.json', + stats: 'assets/bird_walk/bird_walk_stats.json', + images: 'assets/bird_walk/images/' } }, // routes used by angular diff --git a/src/components/services/services.js b/src/components/services/services.js index 3785bdb2..3870044d 100644 --- a/src/components/services/services.js +++ b/src/components/services/services.js @@ -165,7 +165,7 @@ var birdWalkService = {}; - var getUrl = function getUrl(downloadUrl, storeProperty, theScope) { + var getUrl = function getUrl(downloadUrl, storeProperty, theScope, onSuccess) { $http.get(downloadUrl, { cache: true }) @@ -176,10 +176,13 @@ } theScope.spec[storeProperty] = data; - if (data.additionalResources) { - angular.forEach(data.additionalResources, function (value, key) { - getUrl(value, key); - }); +// if (data.additionalResources) { +// angular.forEach(data.additionalResources, function (value, key) { +// getUrl(value, key); +// }); +// } + if (onSuccess) { + onSuccess(); } }).error(function (data, status, headers, config) { diff --git a/src/index.html b/src/index.html index 60b34397..a1fe0600 100644 --- a/src/index.html +++ b/src/index.html @@ -16,9 +16,9 @@ <% }); %> + + - -