-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create /map/ route for wiki pages (#7061)
* add route for map/wiki/:id and display wiki location * add error messages for no location, no wiki * fix codeclimate error * display url hash on page load * Add buttons on wiki pages to link to map or prompt location entry * add redirect from /maps/ to /map/ * change url hash format to #zoom/lat/lon * fix codeclimate error * change button on wiki and page to new hash format * change PublicPagesTest test from /maps to /map * clean up code * remove center tag and unnecessary javascript * add map tests to system tests * include 0 in testing numbers * increase capybara default max wait time * change test tag contributors to a fixed tag name to stop error * remove two tests to check if it passes on server * add map controller tests * attempt to fix travis error * comment out all system map tests * format assertion in show map by hash location in a different way * hide show map by hash location, show correct url for wiki map * Increase wait time for map system tests * update yarn.lock * set max wait time to 90
- Loading branch information
Showing
16 changed files
with
317 additions
and
91 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
function urlMapHash() { | ||
// This is based off of jywarren's urlhash, made specific to our map hash needs | ||
|
||
const paramArray = ["zoom", "lat", "lon"]; | ||
|
||
function getUrlHashParameter(param) { | ||
|
||
var params = getUrlHashParameters(); | ||
return params[param]; | ||
|
||
} | ||
|
||
function getUrlHashParameters() { | ||
|
||
var sPageURL = window.location.hash; | ||
if (sPageURL) sPageURL = sPageURL.split('#')[1]; | ||
var items = sPageURL.split('/'); | ||
var object = {}; | ||
items.forEach(function(item, i) { | ||
if ((item !== '') && (paramArray[i])) object[paramArray[i]] = item; | ||
}); | ||
return object; | ||
} | ||
|
||
// accepts an object like { paramName: value, paramName1: value } | ||
// and transforms to: url.com#zoom/lat/lon | ||
function setUrlHashParameters(params) { | ||
|
||
var values = []; | ||
paramArray.forEach(function(key, i) { | ||
values.push(params[key]); | ||
}); | ||
var hash = values.join('/'); | ||
window.location.hash = hash; | ||
|
||
} | ||
|
||
function setUrlHashParameter(param, value) { | ||
|
||
var params = getUrlHashParameters(); | ||
params[param] = value; | ||
setUrlHashParameters(params); | ||
|
||
} | ||
|
||
return { | ||
getUrlHashParameter: getUrlHashParameter, | ||
getUrlHashParameters: getUrlHashParameters, | ||
setUrlHashParameter: setUrlHashParameter, | ||
setUrlHashParameters: setUrlHashParameters | ||
} | ||
|
||
} |
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
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
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
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
Oops, something went wrong.