-
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.
Disabled unicorn gem for dev coz it bad n shizznee Disabled all of Mark's crappy google maps controls - coz they no work yet modified: Gemfile modified: app/assets/javascripts/angular/controllers/experiments.js modified: app/assets/javascripts/angular/controllers/home.js modified: app/assets/javascripts/app.js new file: app/assets/templates/experiment_base.html modified: app/assets/templates/home.html modified: app/assets/templates/rapid_scanning_experiment.html new file: public/ParticipantInformation.html new file: public/QUT_Square_CMYK.jpg new file: public/experiments/error.png new file: public/experiments/info.png modified: public/experiments/rapid_scan.json new file: public/experiments/success.png new file: public/experiments/warning.png
- Loading branch information
Showing
13 changed files
with
562 additions
and
131 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
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,73 +1,74 @@ | ||
"use strict"; | ||
|
||
function HomeCtrl($scope, $resource, $routeParams, Project) { | ||
|
||
// to get projects to display | ||
// make request only include lat/long and title/desc/id | ||
$scope.projectsResource = $resource('/projects', {}); | ||
$scope.projects = $scope.projectsResource.query(); | ||
|
||
$scope.loadProjects = function(){ | ||
console.log('loadProjects'); | ||
$scope.populateProjectMarkers(); | ||
}; | ||
|
||
// for map | ||
$scope.myMarkers = []; | ||
|
||
$scope.mapOptions = { | ||
center: new google.maps.LatLng(-20.911882621985757, 144.80555550000008), | ||
zoom: 4, | ||
mapTypeId: google.maps.MapTypeId.HYBRID | ||
}; | ||
|
||
$scope.openMarkerInfo = function(marker) { | ||
console.log('openMarkerInfo'); | ||
$scope.currentMarker = marker; | ||
$scope.currentMarkerLat = marker.getPosition().lat(); | ||
$scope.currentMarkerLng = marker.getPosition().lng(); | ||
$scope.currentMarkerTitle = marker.getTitle(); | ||
$scope.currentMarkerId = marker.get('id'); | ||
$scope.myInfoWindow.open($scope.projectMap, marker); | ||
}; | ||
|
||
$scope.addMarker = function($event) { | ||
$scope.myMarkers.push(new google.maps.Marker({ | ||
map: $scope.projectMap, | ||
position: $event.latLng | ||
})); | ||
}; | ||
|
||
$scope.setMarkerPosition = function(marker, lat, lng) { | ||
marker.setPosition(new google.maps.LatLng(lat, lng)); | ||
}; | ||
|
||
$scope.populateProjectMarkers = function(){ | ||
var theProjects = $scope.projects; | ||
var projectCount = theProjects.length; | ||
angular.forEach(theProjects, function(value, key){ | ||
$scope.myMarkers.push(new google.maps.Marker({ | ||
map: $scope.projectMap, | ||
position: new google.maps.LatLng (value.latitude, value.longitude), | ||
title: value.name, | ||
id: value.id | ||
})); | ||
}); | ||
|
||
$scope.zoomMapToFitMarkers(); | ||
}; | ||
|
||
$scope.zoomMapToFitMarkers = function(){ | ||
var bounds = new google.maps.LatLngBounds (); | ||
var markerCount = $scope.myMarkers.length; | ||
for (var index = 0; index < markerCount; index++) { | ||
// And increase the bounds to take this point | ||
bounds.extend ($scope.myMarkers[index].getPosition()); | ||
} | ||
|
||
// Fit these bounds to the map | ||
$scope.projectMap.fitBounds (bounds); | ||
}; | ||
//// TODO: disabled - authentication required for home page - BAD! | ||
//// TODO: properly package this mess ... way too much in this controller | ||
// // to get projects to display | ||
// // make request only include lat/long and title/desc/id | ||
// $scope.projectsResource = $resource('/projects', {}); | ||
// $scope.projects = $scope.projectsResource.query(); | ||
// | ||
// $scope.loadProjects = function(){ | ||
// console.log('loadProjects'); | ||
// $scope.populateProjectMarkers(); | ||
// }; | ||
// | ||
// // for map | ||
// $scope.myMarkers = []; | ||
// | ||
// $scope.mapOptions = { | ||
// center: new google.maps.LatLng(-20.911882621985757, 144.80555550000008), | ||
// zoom: 4, | ||
// mapTypeId: google.maps.MapTypeId.HYBRID | ||
// }; | ||
// | ||
// $scope.openMarkerInfo = function(marker) { | ||
// console.log('openMarkerInfo'); | ||
// $scope.currentMarker = marker; | ||
// $scope.currentMarkerLat = marker.getPosition().lat(); | ||
// $scope.currentMarkerLng = marker.getPosition().lng(); | ||
// $scope.currentMarkerTitle = marker.getTitle(); | ||
// $scope.currentMarkerId = marker.get('id'); | ||
// $scope.myInfoWindow.open($scope.projectMap, marker); | ||
// }; | ||
// | ||
// $scope.addMarker = function($event) { | ||
// $scope.myMarkers.push(new google.maps.Marker({ | ||
// map: $scope.projectMap, | ||
// position: $event.latLng | ||
// })); | ||
// }; | ||
// | ||
// $scope.setMarkerPosition = function(marker, lat, lng) { | ||
// marker.setPosition(new google.maps.LatLng(lat, lng)); | ||
// }; | ||
// | ||
// $scope.populateProjectMarkers = function(){ | ||
// var theProjects = $scope.projects; | ||
// var projectCount = theProjects.length; | ||
// angular.forEach(theProjects, function(value, key){ | ||
// $scope.myMarkers.push(new google.maps.Marker({ | ||
// map: $scope.projectMap, | ||
// position: new google.maps.LatLng (value.latitude, value.longitude), | ||
// title: value.name, | ||
// id: value.id | ||
// })); | ||
// }); | ||
// | ||
// $scope.zoomMapToFitMarkers(); | ||
// }; | ||
// | ||
// $scope.zoomMapToFitMarkers = function(){ | ||
// var bounds = new google.maps.LatLngBounds (); | ||
// var markerCount = $scope.myMarkers.length; | ||
// for (var index = 0; index < markerCount; index++) { | ||
// // And increase the bounds to take this point | ||
// bounds.extend ($scope.myMarkers[index].getPosition()); | ||
// } | ||
// | ||
// // Fit these bounds to the map | ||
// $scope.projectMap.fitBounds (bounds); | ||
// }; | ||
} | ||
|
||
HomeCtrl.$inject = ['$scope', '$resource', '$routeParams', '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
Oops, something went wrong.