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. @anselmbradford moved all
styles to CSS.

- @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).

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

- 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.

@anselmbradford's commit also edits the following:

- Removes the clearMarkers method, which is only needed if the map results
were updated via ajax (which isn’t currently used).

- Removes the metadata and summary text variables, which were no longer
used.

- Adds additional code comments to the map manager code.

- Configures infobox states using a bit mask so that complex interactions
can be programmed as toggleable flags that are then evaluated for to determine
when to open or close the infobox.

- Configures jshint task to allow bitwise operations that are needed for
a bitmask.

- Adds additional styles to the infobox to make it more consistent with
links and other such styling in other parts of the app.

- Adds CSS corner arrow to info box so it’s clearer which marker the info box
is pointing toward.
  • Loading branch information
anselmbradford committed Jul 4, 2014
1 parent 41081aa commit 67bc80f
Show file tree
Hide file tree
Showing 8 changed files with 421 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

0 comments on commit 67bc80f

Please sign in to comment.