Skip to content

Commit

Permalink
FIX: The maps now take URL parameters into account (e.g. filtering by…
Browse files Browse the repository at this point in the history
… location).

This also includes an IE11 polyfill.
  • Loading branch information
Nathan Glasl committed Mar 5, 2019
1 parent 1b8933a commit 353d200
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions code/widget/ListFilterWidgetGoogleMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ public function getFeatureCollection() {

$list = $this->getList();
if (!$list) {
// NOTE(Jake): Ensures if any filters are applied with no user input, that they
// still get applied for map markers.
$list = $this->FilteredList(array());
// When filtering has been applied, fetch the filtered result set
$list = $this->FilteredList($this->getRequest()->getVars());
if (!$list) {
throw new Exception('No form or record configured against '.__CLASS__.'.');
}
Expand Down Expand Up @@ -289,6 +288,7 @@ public function getPopupTemplate(ViewableData $record) {
*/
public function onBeforeRender() {
parent::onBeforeRender();
Requirements::javascript(ListFilterUtility::MODULE_DIR.'/javascript/thirdparty/url-search-params-polyfill.min.js');
Requirements::javascript(ListFilterUtility::MODULE_DIR.'/javascript/ListFilterWidgetGoogleMap.js');
}

Expand Down
2 changes: 1 addition & 1 deletion javascript/ListFilterWidgetGoogleMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
cacheAjaxURL[url] = false;
$.ajax({
type: 'GET',
url: url,
url: url + new URLSearchParams(window.location).get('search'),
async: true,
crossDomain: true,
headers: {
Expand Down
8 changes: 8 additions & 0 deletions javascript/thirdparty/url-search-params-polyfill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 353d200

Please sign in to comment.