Skip to content

Comments

Added default map location to module config & admin map templates#6

Open
loetie wants to merge 2 commits intoarjan:masterfrom
loetie:default-location
Open

Added default map location to module config & admin map templates#6
loetie wants to merge 2 commits intoarjan:masterfrom
loetie:default-location

Conversation

@loetie
Copy link

@loetie loetie commented May 26, 2017

Currently the map default is located in amsterdam.

It would be better if this was a configured option.
To configure this i added a map in the configure modal with wires to save the values.
The values are passed to the javascript function to be used as default values instead of the currently hardcoded values.

</div>
{% else %}
{_ First add the Google maps API key _}
{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest hiding this block (control-group) completely until the Google Maps API key is filled in, as this looks a bit weird:

screen shot 2017-05-29 at 12 18 39

Then add a wire to the API key so that when that is filled in, this block is automatically shown. Otherwise you need to close and re-open the configuration dialog before being able to add a start location.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. It is now added. Also added the original hardcoded values as fallback values if no location has been selected as default location.

rscZoomLevel = parseInt(rscZoomLevel, 10);

defaultLat = parseFloat(defaultLat);
defautlLng = parseFloat(defautlLng);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong name: defautlLng instead of defaultLng (also visible in the JS console).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

… available, reload template after api key inserted
$('#location_lat').trigger("blur");
$('#location_lng').trigger("focus");
$('#location_lng').trigger("change");
$('#location_lng').trigger("blur");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loetie Is this necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was needed so the default config save action was triggered when the hidden fields got filled with a new value. So its to simulate that a field has changed and left.

@ddeboer
Copy link
Contributor

ddeboer commented May 24, 2018

Replaced by zotonic#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants