Skip to content

Commit

Permalink
Merged #2 & #3, Additional changes for v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Apr 20, 2016
1 parent abb316b commit 23b5cef
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ Clone this repo into `craft/plugins/simplemap`.

## Usage
Create the field as you would any other.
The field type will return an array containing `lat`, `lng`, and `address`. This means you can use `{{ myMapField.lat }}`.
The field type will return an array containing `lat`, `lng`, `zoom`, and `address`. This means you can use `{{ myMapField.lat }}`.

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

## Changelog

### 1.1.0
- Merged \#2 & \#3 from @cballenar
- \#2 - Field now stores map zoom
- \#3 - Improved handling of unknown locations
- Improved error message display

### 1.0.2
- Added link to docs
- Added releases json for updates
Expand Down
2 changes: 1 addition & 1 deletion SimpleMapPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getDescription()

public function getVersion()
{
return '1.0.2';
return '1.1.0';
}

public function getSchemaVersion()
Expand Down
11 changes: 11 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,16 @@
"Added link to docs",
"Added releases json for updates"
]
},
{
"version": "1.1.0",
"downloadUrl": "https://github.com/ethercreative/SimpleMap/archive/v1.1.0.zip",
"date": "2016-04-20T10:00:00-08:00",
"notes": [
"Merged #2 & #3 from https://github.com/cballenar",
"#2 - Added zoom",
"#3 - Improved handling of unknown locations",
"Improved error message display"
]
}
]
5 changes: 3 additions & 2 deletions resources/SimpleMap_Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ var SimpleMap = function (mapId, settings) {
};

SimpleMap.Fail = function (message) {
if (window.console) console.error('SimpleMap:', message);
Craft.cp.displayError('<strong>SimpleMap:</strong> ' + message);
if (window.console) console.error.apply(console, ['%cSimpleMap: %c' + message, 'font-weight:bold;','font-weight:normal;']);
};

SimpleMap.LoadGoogleAPI = function () {
Expand Down Expand Up @@ -124,7 +125,7 @@ SimpleMap.prototype.setupMap = function () {
// Update map to saved zoom
this.map.setZoom(parseInt(zoom));

// When the autocomplete place changes
// When the auto-complete place changes
google.maps.event.addListener(autocomplete, 'place_changed', function () {
var address = self.address.value, lat, lng;
self.inputs.address.value = address;
Expand Down
8 changes: 4 additions & 4 deletions templates/map-fieldtype.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div id="{{ id }}" class="simplemap--map"></div>

<input type="hidden" name="{{ name }}[lat]" value="{{ value is not null and value.lat ? value.lat : '' }}" id="{{ id }}-input-lat">
<input type="hidden" name="{{ name }}[lng]" value="{{ value is not null and value.lng ? value.lng : '' }}" id="{{ id }}-input-lng">
<input type="hidden" name="{{ name }}[zoom]" value="{{ value is not null and value.zoom ? value.zoom : '' }}" id="{{ id }}-input-zoom">
<input type="hidden" name="{{ name }}[address]" value="{{ value is not null and value.address ? value.address : '' }}" id="{{ id }}-input-address">
<input type="hidden" name="{{ name }}[lat]" value="{{ value is not null and value.lat is defined ? value.lat }}" id="{{ id }}-input-lat">
<input type="hidden" name="{{ name }}[lng]" value="{{ value is not null and value.lng is defined ? value.lng }}" id="{{ id }}-input-lng">
<input type="hidden" name="{{ name }}[zoom]" value="{{ value is not null and value.zoom is defined ? value.zoom }}" id="{{ id }}-input-zoom">
<input type="hidden" name="{{ name }}[address]" value="{{ value is not null and value.address is defined ? value.address }}" id="{{ id }}-input-address">

0 comments on commit 23b5cef

Please sign in to comment.