Skip to content

Commit

Permalink
Fixes #365 - Edit UX for results map
Browse files Browse the repository at this point in the history
In this branch, @millereric made some UX changes to the results map
view in response to Issue #365 ("Google Map rollover is cropped out of
view some times."). @millereric used infoBox.js from the Google
Maps utility library, because it allows for easy customizability,
including position and styling. Presently, the infoBox is displayed to
the right of markers to decrease the likelihood of it being cropped out
of the window. The infoBox can be styled either within its options
object, or by linking to a CSS stylesheet.

(1) @millereric set the marker's optimized property to false in order to
prevent events from propagating through the infoBox onto the map (e.g.
to prevent markers underneath an open infoBox from registering a
mouseover event).

(2) @anselmbradford added a z-index for the close box [x] per
@millereric original edit, because it was visible but not clickable.

(3) infoBox.js requires the google maps api to be fully loaded before
it is loaded. This has presented some difficulties because of the
asynchronous loading of the google maps api. @anselmbradford nested the
dependencies so they loaded in order, which consequentially required
the result-map-manager to become self-executing, for better or worse.
  • Loading branch information
anselmbradford committed Jul 1, 2014
1 parent 41081aa commit 19890f9
Show file tree
Hide file tree
Showing 6 changed files with 231 additions and 148 deletions.
3 changes: 1 addition & 2 deletions app/assets/javascripts/detail/no-detail-map-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ define(['app/alert-manager'],function (alert) {
{
console.log("Map failed to load! Hiding map HTML code.");

var mapContainer = document.getElementById('detail-map-view');
mapContainer.className = 'hide';
document.getElementById('detail-map-view').className = 'hide';

alert.show("Oops! Map failed to load. Try reloading the page or <a href='/about/#feedback-box'>send us a message</a>.");
}
Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/result/no-result-map-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ define(['app/alert-manager'],function (alert) {
{
console.log("Map failed to load! Hiding map HTML code.");

var mapContainer = document.getElementById('map-view');
mapContainer.className = 'hide';
document.getElementById('map-view').className = 'hide';
document.getElementById('map-view-control').className = 'hide';

alert.show("Oops! Map failed to load. Try reloading the page or <a href='/about/#feedback-box'>send us a message</a>.");
}
Expand Down
11 changes: 10 additions & 1 deletion app/assets/javascripts/result/result-init.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
require(['result/result-map-manager','search/header-manager'], function (map,header) {
'use strict';

map.init();
// The map module is self-executing because it requires two sequential non-AMD
// modules that depend on each other (Google Maps and Google Maps Utilities Library).
// Therefore, it needs to asynchronously load Google Maps and then load the
// Map Utility Library, which means its init function's scope can't be
// reached at this level of code, so the init function is set to automatically
// execute after it is defined, within the module.
// If the map module is refactored to allow calling of the init function
// from this scope (to control execution order), then the following line
// can be uncommented:
//map.init();
header.init();

}, function (err) {
Expand Down
Loading

0 comments on commit 19890f9

Please sign in to comment.