-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed breadcrumbs to get title from route configuration.
Active item in navbar is now selected based on url. Bird walk resources added (not committed), along with abilty to load and display thumbnails of available bird walks.
- Loading branch information
Mark Cottman-Fields
committed
Nov 8, 2013
1 parent
34c4eda
commit b71d612
Showing
9 changed files
with
499 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,8 @@ doc/ | |
/log/*.log | ||
/tmp | ||
|
||
|
||
# bird walk resources | ||
/src/assets/bird_walk/* | ||
|
||
/.project | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,54 @@ | ||
angular.module('bawApp.birdWalks', []) | ||
.controller( | ||
'BirdWalkCtrl', | ||
['$scope', '$resource', '$routeParams', | ||
/** | ||
* The navigation controller. Here we setup breadcrumbs. | ||
* @param $scope | ||
* @param $resource | ||
* @constructor | ||
* @param $routeParams | ||
*/ | ||
function BirdWalkCtrl($scope, $resource, $routeParams) { | ||
['$scope', '$resource', '$routeParams','$route', '$http', | ||
function BirdWalkCtrl($scope, $resource, $routeParams, $route, $http) { | ||
// set up results | ||
$scope.results = { | ||
allowContact: true, | ||
consented: false, | ||
ethicsStatementViewed: false, | ||
pageHit: (new Date()).toISOString() | ||
}; | ||
|
||
$scope.spec = {}; | ||
|
||
$scope.imagesPath = '/assets/bird_walk/images/'; | ||
|
||
// download bird walk specification | ||
downloadResources('/assets/bird_walk/bird_walk_spec.json', 'birdWalkSpec'); | ||
|
||
function downloadResources(primaryResource, primaryStoreProperty) { | ||
var maxAttempts = 5; | ||
|
||
function downloadRecursive(attemptsLeft, resource, storeProperty) { | ||
if (attemptsLeft > 0) { | ||
$http.get(resource + "?antiCache=" + Date.now().toString()) | ||
.success(function (data, status, headers, config) { | ||
$scope.spec[storeProperty] = data; | ||
|
||
console.info("Downloading resource " + resource + " succeeded.", data); | ||
|
||
if (data.additionalResources) { | ||
angular.forEach(data.additionalResources, function (value, key) { | ||
downloadRecursive(maxAttempts, value, key); | ||
}); | ||
} | ||
}) | ||
.error(function (data, status, headers, config) { | ||
console.error("Downloading resource " + resource + " failed. Attempt " + (maxAttempts - attemptsLeft) + " of " + maxAttempts); | ||
|
||
downloadRecursive(attemptsLeft--, resource, storeProperty); | ||
}); | ||
} | ||
else { | ||
console.error("Downloading resource " + resource + " failed after " + maxAttempts + "attempts"); | ||
} | ||
} | ||
|
||
downloadRecursive(maxAttempts, primaryResource, primaryStoreProperty); | ||
|
||
|
||
} | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<div class="row" data-ng-controller="BirdWalkCtrl"> | ||
|
||
<div class="col-sm-6 col-md-3" data-ng-repeat="(name, walkSpec) in spec.birdWalkSpec.walks"> | ||
<div class="thumbnail"> | ||
<img data-ng-src="{{$parent.imagesPath + $parent.spec.birdWalkSpec.locations[walkSpec.locationName].backgroundImageName}}" | ||
alt="{{name}}" class="img-responsive"> | ||
|
||
<div class="caption"> | ||
<h3>{{name}} | ||
<small>{{walkSpec.waypoints.length}} waypoint(s)</small> | ||
</h3> | ||
<p>{{walkSpec.description}}</p> | ||
|
||
<p> | ||
<a href="#" class="btn btn-default" role="button">Begin Bird Walk</a> | ||
</p> | ||
|
||
<p class="text-muted small"> | ||
Image Source: | ||
<a data-ng-href="{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].backgroundImageAttributionLink}}"> | ||
{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].backgroundImageAttribution}} | ||
</a> | ||
</p> | ||
<!-- | ||
<h3>{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].name}}</h3> | ||
<p>{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].locationDescription}} | ||
<a data-ng-href="{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].locationDescriptionAttributionLink}}" | ||
class="small"> | ||
{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].locationDescriptionAttribution}} | ||
</a> | ||
</p> | ||
<h4>{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].environmentType}}</h4> | ||
<p>{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].environmentDescription}} | ||
<a data-ng-href="{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].environmentDescriptionAttributionLink}}" | ||
class="small"> | ||
{{$parent.spec.birdWalkSpec.locations[walkSpec.locationName].environmentDescriptionAttribution}} | ||
</a> | ||
</p> | ||
--> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<ol class="breadcrumb"> | ||
<li><a href="/">Home</a></li> | ||
<li><a href="/listen">Listen</a></li> | ||
<li class="active">Listening to 40</li> | ||
</ol> | ||
<ul class="breadcrumb"> | ||
<li ng-repeat="breadcrumb in breadcrumbs.getAll()" ng-class="{ active: $last }"> | ||
<a ng-if="!$last" ng-href="{{breadcrumb.path}}">{{breadcrumb.title}}</a> | ||
<span ng-if="$last">{{breadcrumb.title}}</span> | ||
</li> | ||
</ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.