Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Map Location #6

Open
tompipe opened this issue Jun 2, 2017 · 4 comments
Open

Optional Map Location #6

tompipe opened this issue Jun 2, 2017 · 4 comments

Comments

@tompipe
Copy link

tompipe commented Jun 2, 2017

Added a map property to a doctype where selecting a location is optional.

Upon saving the page, the map always sets a location to the default location set on the datatype.

Unsetting the default location on the data type doesn't seem to be possible.

@Joniff
Copy link
Owner

Joniff commented Jun 2, 2017

Very interesting.

Currently the situation is that at all times a map marker has to exist on the map, and deleting/removing the current location only returns you to a default position. I could say this was by design, but its more, a very tight coupling between the map marker and the lat/lng text box.

To break that link, would cause me some headaches. For example I would need a new state, lets call it null position, where no map marker appears. I feel I might need, for UX reasons, a new special button, lets call it 'clear' or 'no location' to exist right of the lat/lng text box to clear the current location.

I agree that a null position, eg. a map pointing nowhere, should exist. This would take a bit of programming to organise. I will add this to the roadmap, but I feel this will take a low priority, only because its not a simple request. It would change config, editor view and the strongly type class that represents a Terratype map - plus what happens if you try and render a null position map in a razor template? No map appears, I'm not sure what should happen.

As a horrible temporary hack, you could add a check box to your own doctypes, that sort of switches on/off the map. not great, I know. Sorry.

@Myster
Copy link

Myster commented Aug 19, 2018

An example may help clarify this requirement:
Imagine an "Training Session" doc type, with a terratype to say where it is.
If a training session is online it does not have a location.
The razor page should omit the map entirely. (In any case this is the concern of the template maker, not the datatype)
To clear the location I don't think you need any UX, my natural action was to delete the lat/lng coordinate textbox.
I also don't think you need to change the strongly typed class, as long as you can return 'null' in those cases where it has no value. (this isn't deeply thought out, so perhaps there's issues doing it that way???)

@Joniff
Copy link
Owner

Joniff commented Aug 20, 2018

The UX required is around what does the map display to the content editor when the map is null, how do they select a location afterwards if they don't wish the map being null anymore.

@danimalx
Copy link

danimalx commented Aug 9, 2022

A related question... would it be possible to make the map a mandatory field? At the moment if you make it mandatory then it always validates as there is a default location. If the default were only shown when the map was not mandatory then it would force users to select a location.

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

No branches or pull requests

4 participants