Skip to content

Commit

Permalink
Merge branch 'v3-dev' into v3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Jan 30, 2018
2 parents 0bf70ba + c637657 commit 2d463cb
Show file tree
Hide file tree
Showing 18 changed files with 729 additions and 160 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 3.3.0 - 2018-01-30
### Fixed
- Added a fix for those annoying `Call to a member function getMap() on null` bugs

### Improved
- Map height no longer jumps when page loads
- Vastly improved the map fields settings UI/UX
- No more nasty text fields!
- Map height and position is now set by resizing and moving a map
- Auto-complete search bounds can now be drawn directly onto a map
- Radio buttons are now drop-downs

### Changed
- Now using the plugins `afterInstall` function instead of the plugin after install event
- The "Hide Lat/Lng" option is now true by default

## 3.2.0 - 2018-01-25
### Fixed
- Fixed bug where pagination would error when querying via a map field. #70
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
![SimpleMap](resources/banner.jpg)
![SimpleMap](resources/imgs/banner.jpg)

# SimpleMap
A beautifully simple Google Map field type for **Craft 3**. Full localization support, compatible with Matrix & [CraftQL](https://github.com/markhuot/craftql), supports
searching by location and sorting by distance.

[Click here for the **Craft 2.5** version.](https://github.com/ethercreative/simplemap/tree/v2)

![How it looks](resources/preview.png)
![How it looks](resources/imgs/preview.png)

## Usage
Create the field as you would any other.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ether/simplemap",
"description": "A beautifully simple Google Map field type.",
"version": "3.2.0",
"version": "3.3.0",
"type": "craft-plugin",
"license": "MIT",
"minimum-stability": "dev",
Expand Down
21 changes: 21 additions & 0 deletions resources/.buildrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"less": {
"ignore": true,
"input": "public/assets/less/style.less",
"output": "public/assets/css",
"watch": [
"public/assets/less/**/*"
]
},
"js": {
"ignore": false,
"input": "./js/SimpleMapSettings.js",
"output": "../src/resources/SimpleMapSettings.min.js",
"watch": [
"./js/**/*.js"
]
},
"browserSync": {
"ignore": true
}
}
File renamed without changes
File renamed without changes
46 changes: 46 additions & 0 deletions resources/js/Helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/* globals google */

/**
* Load the google API into the dom
*
* @param {string} key - Google Maps API key
* @param {string} locale - The locale
* @param {boolean=} includeDrawing - Include the drawing library
* @static
*/
export const loadGoogleAPI = function (key, locale, includeDrawing = false) {
window.simpleMapsLoadingGoogle = true;

const gmjs = document.createElement("script");
gmjs.type = "text/javascript";
gmjs.src = "https://www.google.com/jsapi?key=" + key;
gmjs.onreadystatechange = function () {
loadMapsApi(key, locale, includeDrawing);
};
gmjs.onload = function () {
loadMapsApi(key, locale, includeDrawing);
};
document.body.appendChild(gmjs);
};

/**
* Load the google maps API into the dom
*
* @param {string} key - Google Maps API key
* @param {string} locale - The locale
* @param {boolean=} includeDrawing - Include the drawing library
* @static
*/
export const loadMapsApi = function (key, locale, includeDrawing = false) {
google.load("maps", "3", {
other_params: [
"libraries=places" + (includeDrawing ? ",drawing" : ""),
`key=${key}`,
`language=${locale.replace("_", "-")}`,
`region=${locale}`,
].join("&"),
callback: function () {
document.dispatchEvent(new Event("SimpleMapsGAPILoaded"));
}
});
};
Loading

0 comments on commit 2d463cb

Please sign in to comment.