Skip to content

Commit

Permalink
⬆️ Upgrade to be compatible with SS4
Browse files Browse the repository at this point in the history
  • Loading branch information
tauap committed Jul 3, 2019
1 parent 25099f6 commit 15345b5
Show file tree
Hide file tree
Showing 33 changed files with 250 additions and 248 deletions.
Empty file modified .editorconfig
100644 → 100755
Empty file.
Empty file modified CONTRIBUTING.md
100644 → 100755
Empty file.
Empty file modified LICENSE.md
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
13 changes: 0 additions & 13 deletions _config.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
<?php
/**
* Developed by http://www.i-lateral.com/ and loosley based on the module provided by
* www.sunnysideup.co.nz
*
* @author: Nicolaas - modules [at] sunnysideup.co.nz
* @author: Mo - morven [at] i-lateral.com
*
**/

// Add extensions
Object::add_extension('SiteConfig', 'GoogleMapSiteConfig');
Object::add_extension('SiteTree', 'GoogleMapSiteTree');
Object::add_extension('ContentController', 'GoogleMapController');
12 changes: 12 additions & 0 deletions _config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: googlemaps
---
SilverStripe\Control\Controller:
extensions:
- 'ilateral\SilverStripe\GoogleMaps\Extensions\ControllerExtension'
SilverStripe\CMS\Model\SiteTree:
extensions:
- 'ilateral\SilverStripe\GoogleMaps\Extensions\GoogleMapsExtension'
SilverStripe\SiteConfig\SiteConfig:
extensions:
- 'ilateral\SilverStripe\GoogleMaps\Extensions\SiteConfigExtension'
6 changes: 6 additions & 0 deletions _config/legacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
Name: googlemapslegacy
---
SilverStripe\ORM\DatabaseAdmin:
classname_value_remapping:
GoogleMap: ilateral\SilverStripe\CustomMenus\Model\GoogleMap
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 28 additions & 18 deletions javascript/gmap3.js → client/thirdparty/javascript/gmap3.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* GMAP3 Plugin for jQuery
* Version : 7.1
* Date : 2016/04/17
* Version : 7.2
* Date : 2016/12/03
* Author : DEMONTE Jean-Baptiste
* Contact : jbdemonte@gmail.com
* Web site : http://gmap3.net
Expand Down Expand Up @@ -89,7 +89,7 @@
}

function ready(fn) {
if (document.readyState != 'loading'){
if (document.readyState != 'loading') {
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
Expand All @@ -103,7 +103,7 @@
}

// Auto-load google maps library if needed
(function () {
when(function () {
var dfd = deferred(),
cbName = '__gmap3',
script;
Expand All @@ -126,8 +126,8 @@
}
});

return dfd.promise();
})().then(function () {
return dfd;
}()).then(function () {
$.holdReady(false);
});

Expand Down Expand Up @@ -172,11 +172,11 @@
address: request
};
}
service('Geocoder').geocode(request, function(results, status) {
service('Geocoder').geocode(request, function (results, status) {
if (status === gm.GeocoderStatus.OK) {
dfd.resolve(results[0].geometry.location);
} else {
dfd.reject();
dfd.reject(status);
}
});
return dfd;
Expand All @@ -194,7 +194,7 @@
* @param {StringCallback} fn - Callback function
*/
function foreachStr(str, fn) {
str.split(' ').forEach(fn);
foreach(str.split(' '), fn);
}

/**
Expand Down Expand Up @@ -263,13 +263,16 @@
if (address) {
delete options.address;
return geocode(address).then(function (latLng) {
options[key] = latLng;
});
options[key] = latLng;
});
}
options[key] = toLatLng(options[key]);
})
.then(function () {
dfd.resolve(fn(options));
})
.fail(function (reason) {
dfd.reject(reason);
});
return dfd;
}
Expand All @@ -284,9 +287,7 @@
*/
function resolveArrayOfLatLng(options, key, fn) {
options = dupOpts(options);
options[key] = (options[key] || []).map(function (item) {
return toLatLng(item);
});
options[key] = (options[key] || []).map(toLatLng);
return resolved(fn(options));
}

Expand Down Expand Up @@ -388,7 +389,7 @@
self.draw();
};

self.draw = function() {
self.draw = function () {
var sw = fromLatLngToDivPixel(options.bounds.getSouthWest());
var ne = fromLatLngToDivPixel(options.bounds.getNorthEast());

Expand Down Expand Up @@ -840,7 +841,7 @@
$.each(events, function (eventName, handlers) {
foreach(instances, function (instance) {
var isClusterOverlay = instance instanceof ClusterOverlay;
var isDom = isClusterOverlay || (instance instanceof gm.OverlayView);
var isDom = isClusterOverlay || (instance instanceof gm.OverlayView);
var eventListener = isDom ? instance.$.get(0) : instance;
gm.event['add' + (isDom ? 'Dom' : '') + 'Listener' + (once ? 'Once' : '')](eventListener, eventName, function (event) {
foreach(handlers, function (handler) {
Expand Down Expand Up @@ -892,7 +893,7 @@
/**
* Decorator to chain promise result onto the main promise chain
* @param {Function} fn
* @returns {Deferred}
* @returns {Function}
*/
function chainToPromise(fn) {
return function () {
Expand Down Expand Up @@ -1085,6 +1086,15 @@
}
};

self.catch = function (fn) {
if (isFunction(fn)) {
promise = promise
.then(null, function (reason) {
return when(fn.call(context(), reason));
});
}
};

foreachStr('on once', function (name, once) {
self[name] = function () {
var events = arguments[0];
Expand Down Expand Up @@ -1128,4 +1138,4 @@
}
}

})(jQuery, window, document);
})(jQuery, window, document);
10 changes: 10 additions & 0 deletions client/thirdparty/javascript/gmap3.min.js

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

119 changes: 0 additions & 119 deletions code/extension/GoogleMapController.php

This file was deleted.

35 changes: 26 additions & 9 deletions composer.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "i-lateral/silverstripe-googlemaps",
"description": "A module to allow embeding of google maps inside page objects",
"type": "silverstripe-module",
"name": "i-lateral/silverstripe-googlemaps",
"description": "A module to allow embeding of google maps inside page objects",
"type": "silverstripe-vendormodule",
"homepage": "http://github.com/i-lateral/silverstripe-googlemaps",
"keywords": ["silverstripe", "googlemaps"],
"license": "BSD-3-Clause",
Expand All @@ -15,12 +15,29 @@
"issues": "http://github.com/i-lateral/silverstripe-googlemaps/issues"
},
"require": {
"silverstripe/framework": ">=3.1",
"silverstripe/cms": ">=3.1",
"betterbrief/silverstripe-googlemapfield": "*",
"symbiote/silverstripe-gridfieldextensions": "~2.0"
"silverstripe/framework": "^4.0",
"silverstripe/cms": "^4.0",
"betterbrief/silverstripe-googlemapfield": "^2.0",
"symbiote/silverstripe-gridfieldextensions": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"silverstripe/vendor-plugin": "^1",
"squizlabs/php_codesniffer": "^3.0"
},
"autoload": {
"psr-4": {
"ilateral\\SilverStripe\\GoogleMaps\\": "src/"
}
},
"extra": {
"installer-name": "googlemaps"
}
"installer-name": "googlemaps",
"expose": [
"client/dist",
"client/lang",
"client/thirdparty"
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
Binary file removed docs/en/_images/google-maps-address-info.png
Binary file not shown.
Binary file removed docs/en/_images/google-maps-api-key.png
Binary file not shown.
Binary file removed docs/en/_images/google-maps-map-list.png
Binary file not shown.
Binary file removed docs/en/_images/google-maps-map-screen.png
Binary file not shown.
Binary file removed docs/en/_images/google-maps-options.png
Binary file not shown.
Loading

0 comments on commit 15345b5

Please sign in to comment.