Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early polling marker changes from red to green on hover #69

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require.config({
bootstrapCarousel: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/carousel',
bootstrapCollapse: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse',
bootstrapDropdown: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/dropdown',
bootstrapModal: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/modal',
bootstrapPopover: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/popover',
bootstrapScrollspy: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/scrollspy',
bootstrapTab: '../bower_components/bootstrap-sass/assets/javascripts/bootstrap/tab',
Expand Down Expand Up @@ -39,9 +38,6 @@ require.config({
bootstrapDropdown: {
deps: ['jquery']
},
bootstrapModal: {
deps: ['jquery', 'bootstrapTransition']
},
bootstrapPopover: {
deps: ['jquery', 'bootstrapTooltip']
},
Expand Down Expand Up @@ -187,7 +183,6 @@ require(['jquery',
var link = $('<a>').text(result.formatted_address).data('location', result.geometry.location).on('click', addressClickHandler);
$('<li>').append(link).appendTo($ul);
}
$('.modal').modal('hide');
}
}

Expand All @@ -206,9 +201,9 @@ require(['jquery',
zipCode = zipCodeComponent && zipCodeComponent.short_name;

var isInCambridge = ($.inArray(zipCode, ['02138', '02139', '02140', '02141', '02142', '02238'])) > -1,
isStreetAddress = ($.inArray('street_address', address.types)) > -1;
isNotPO = ($.inArray('post_box', address.types)) == -1;

return isInCambridge && isStreetAddress;
return isInCambridge && isNotPO;
}

geocoder.geocode({
Expand All @@ -221,7 +216,6 @@ require(['jquery',

// if there are multiple results, look for Cambridge-specific street results
results = $.grep(results, addressIsCambridgeStreetAddress);

// if there are no results, try searching for Cambridge
if (!results.length) {
geocoder.geocode({ address: address + ' Cambridge, MA' }, function(results, status) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/early_voting_mgr.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define(
function whenMarkerEventsHappen(eventType, marker) {
if (eventType === 'click') {
for (var i = 0; i < earlyVotingLocations.length; i++) {
if (marker.getPosition().equals(earlyVotingLocations[i].getGeometry().get())) {
if (marker.getPosition().equals(earlyVotingLocations[i].getGeometry().get())) {
$el.scrollTo($('#location'+i), 800);
}
}
Expand Down
18 changes: 14 additions & 4 deletions app/scripts/map_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,23 @@ define(['json!vendor/EARLY_VOTING_AddressPoints.geojson'],

function createEarlyPollingMarkers() {
earlyPollingLocations.forEach(function(poll, index) {
var earlyVotingMarker = new google.maps.Marker({
var marker = new google.maps.Marker({
position: poll.getGeometry().get()

});
marker.addListener('click', function() {
fireMarkerEvent('click', marker);
});

marker.addListener('mouseover', function() {
marker.setIcon(hoverIcon);
});
earlyVotingMarker.addListener('click', function() {
fireMarkerEvent('click', earlyVotingMarker);

marker.addListener('mouseout', function() {
marker.setIcon(defaultIcon);
});
earlyPollingMarkers.push(earlyVotingMarker);

earlyPollingMarkers.push(marker);
});
}

Expand Down
6 changes: 1 addition & 5 deletions app/scripts/polling_location_finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ define(['jquery',

return function(latLng, successCallback, errorCallback) {


var userPrecinct = getUserPrecinct(latLng);



if (!userPrecinct) {
$('#notice')
.addClass('error')
Expand All @@ -84,8 +82,6 @@ define(['jquery',

var destination = pollingLocation.getProperty('Address') + ', Cambridge, MA';
mapService.displayNewPollingPlace(latLng, destination, userPrecinct, successCallback, errorCallback);
// userPrecinct.setMap(map);
// map.fitBounds(userPrecinct.getBounds());

// display location notes
$('#info .location').text(pollingLocation.getProperty('LOCATION'));
Expand Down
4 changes: 2 additions & 2 deletions app/scripts/templates/early_voting_sidebar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div class="early-voting-location" id="location<%= i %>">
<div id="heading<%= i %>" role="tab">
<h4>
<a role="button" data-toggle="collapse" data-parent="#early-voting-sidebar" href="#collapse<%= i %>" aria-expanded="false" aria-controls="collapse<%= i %>">
<%= location.getProperty('LOCATION') %>
<a id="#collapse-toggle<%= i %>" role="button" data-toggle="collapse" data-parent="#early-voting-sidebar" href="#collapse<%= i %>" aria-expanded="false" aria-controls="collapse<%= i %>">
<%= location.getProperty('LOCATION') %>
</a>
</h4>
</div>
Expand Down