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
EZP-28647: Difference in edit and preview mode for map location #2236
EZP-28647: Difference in edit and preview mode for map location #2236
Conversation
I think that the proper handling of NULL vs 0 values should not go together with the switch from gmaps to openstreetmap. |
Agree with @gggeek here. |
@gggeek @crevillo At the product management we decided to drop Google Maps support for Open Source version of the Product in favour of Open Street Maps. For consistency with new admin UI introduced in 2.0.0 version we have to change it too here. This PR should go to master (kernel 7.1) as it might be unexpected change for .dot release for those who are already started using it. This template has been a bit outdated and we will do more cleanups bringing it up to date, likely BC will happen in version 2.1.0. We will document all possible BCs in the official release note. |
Dunno.... i'd say this dont fit semantic versioning principles. |
It is just a principle, we are at the beginning of .0 for 2.x series and we have to make this cleanup. I fully understand BCs might be painful, but it is temporary pain. But we will document it. Last composer change broke literally all open source projects due to licensing change in .dot release. Things like that will happen. And that did not fit semantic versioning. |
Ok. Probably easy to understand for me, not that easy for possible customers. |
I also agree with @gggeek, there should be some kind of BC layer here for existing users. eZ always took pride in its BC policy, so this feels kinda counterproductive. What's wrong in making it configurable? Will the old version of the template be provided for those who do not want to switch? The argument that others do it, so we can too is wrong in my opinion. That's not how semver should work. |
@crevillo current inconsistent behaviour will do a lot more damaged to developers and customers expectations where admin UI got Open Street Map and frontend got Google Maps. This PR fixes it. |
@emodric Netgen Tags introduced BC break be changing param name from eztags to netgen tags prefix, without informing anyone about, that broken ezplatform.com for instance. We are not using argument that others doing it like that. Main argument is maintenance cost that someone need to take at some point. |
That change happened in version 3.0 I think, where BC break is allowed, and it was documented in release notes. If I'm wrong and if it happened in minor release, it should've been reported :) The problem with this change is that it directly ties into that the frontend will change in most cases on customers' sites after the upgrade, which is far more important than an inconsistency in admin. |
@emodric I'm afraid change happened in one of minor versions. We will document this change as part of upgrade process. |
I am sorry about that then, it should've been reported :) Documenting it is not enough maybe. In my opinion, you should provide a way for people to revert back to Google Maps if they wish. |
What @emodric says is exactly my point. one of the goodness of ez is that you can use ezpublish-kernel without (any) admin bundle. And that's exactly what we're trying in some current projects and what we are offering to some others possible customers. So, i don't think what happened in the admin bundle should introduce a BC change in the kernel. That said, if finally this goes in, we could remove this line, right? https://github.com/ezsystems/ezpublish-kernel/pull/2236/files#diff-c8b22ddd1af7311bccfea99ccb809930R359 |
Finally on my side
|
With point #1 I strongly believe upgrade path won't be difficult and time consuming. It is only presentation layer after all. Thank you for your all feedback and understanding. |
@lserwatka / et al: I think some of the differences here comes from some thinking we follow Symfony's BC promise, and assuming this template code is per SemVer an API, which per SemVer implies increasing major version bump on changes. We don't necessarily follow Symfony on everything, they are making something a bit different then we do, however we are overdue for clarifying what we follow as SemVer has lots of grey area. Problem with trying to force us to follow Symfony on everything; this is not the only place we have a need for cleanup, some of the others:
To avoid us being forced to do a major release on every release like browser vendors do, a compromise to allow continued innovation would perhaps be something along:
I have a draft blog post from end of last year I can try to finish if anyone would like to review and discuss this. For instance if we do a first round @lserwatka and then I do some further rounds with community maintaners to align on this would that be ok for all? |
<script> | ||
if (typeof(window.ezgmaplocationMapsScriptLoaded) == 'undefined') { | ||
(function (win, doc) { | ||
var myScript = document.createElement('script'); | ||
myScript.src = '//maps.googleapis.com/maps/api/js{% if apiKey %}?key={{ apiKey }}{% endif %}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not used anymore we should deprecate the setting (including describing that it is not used anymore)
@andrerom It would awesome if things could be explained in detail and to stick with it. I recognize that eZ kernel does not need to follow SemVer or Symfony's BC promise, but the rules we do decide to follow should be explained in the similar manner to http://symfony.com/doc/current/contributing/code/bc.html (with yes/no tables and everything), so your blog post and proper BC policy docs are much needed. Symfony BC promise and SemVer aside, what I would definitely like to see kept is eZ's strong BC policy. Deprecate things if you need them being deprecated, but don't flat out remove features users depend on without a proper deprecation period, especially since eZ always prided itself in its BC policy, which even held through with eZ 5 and eZ legacy compatibility. |
@@ -357,55 +357,59 @@ | |||
|
|||
{% if hasContent and showMap %} | |||
{% set apiKey = ezpublish.configResolver.hasParameter('api_keys.google_maps') ? ezpublish.configResolver.getParameter('api_keys.google_maps'): "" %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed from here as well. Can you please add info that this config is deprecated now?
Guys, I don't really see a BC problem here :) Personal POV: I also don't like treating Twig templates as an API and also don't like relying on templates coming from Kernel. These are lightweight minimal examples that should be overridden for the purpose of an actual site. But I know I'm alone in that opinion :) What I disagree about is deprecating So I'm with @lserwatka previous comment, we should make a doc stating that this changed and how to override template with the version using Google Maps. I find it hard to believe someone on production site didn't need to override this particular template (problem doesn't exist in such case), but maybe that's just me and my approach to dev with eZ ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: It would be nice if @sunpietro or @dew326 could do a review of JS 😀
My review remarks:
@@ -280,7 +282,6 @@ | |||
{% block ezgmaplocation_field %} | |||
{## | |||
# This field type block accepts the following parameters: | |||
# - string mapType the Google map type (ROADMAP, SATELLITE, HYBRID or TERRAIN), default is ROADMAP | |||
# - boolean showMap whether to show the Google map or not, default is true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop "Google" from the sentence please :)
Also there's the reference to Google's JS API at the bottom of this comment block (can't point it here). Some updated link to OpenStreet doc would be good.
(function (win) { | ||
var mapView = function (mapId, latitude, longitude) { | ||
var mapConfig = { | ||
dragging: {{ zoom }}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this accurate? I can't find OpenStreetMap API doc on that setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's in the doc http://leafletjs.com/reference-1.3.0.html#map-dragging
But I think {{ zoom }}
is not the proper value for dragging
parameter. Shouldn't this config looks like this?:
...
dragging: {{ draggable }},
zoom: {{ zoom }},
...
@alongosz yes and no. i mean, customers can have projects using ezpublish kernel 7.0, use the default template for showing the google map and modify other templates to interact with this google map. if we change that to open street map, all the code they have written to interact with gmaps will need to be rewritten also. we can discuss if this is a bc or not, but otoh, i still think that solution proposed by @gggeek is doable and will have more people happy with it. |
In my opinion, front facing templates which have a direct impact on how the page looks like in frontend should be considered public API. This includes XSLT transformations for rich text tags, as well as default templates from the kernel. I'm sure there is a number of users who definitely rely on built in templates, or even worse, have other code that directly depends on this template and Google Maps. But as @andrerom hinted, this all needs a proper discussion with the community to determine what the community wants included in the BC policy. |
@crevillo I would rather override template with version supporting gmaps. It's just about copying version supporting GMaps to application. Much simpler than rewriting to OpenStreetMap. How to do it - this is what I've suggested for doc about this change. That said, maybe it's a good idea to provide some config, however I don't see in my head a proper clean solution yet. |
Well, i know some cases like this. think in all people that uses ezpublish legacy admin, which, if i'm not wrong, still uses gmaps. |
false | ||
); | ||
} else if (win.attachEvent) { | ||
win.attachEvent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one can be dropped as we don't support IE10 and older browsers. Please, stick to addEventListener
method only.
myScript.crossorigin = ""; | ||
myCss.rel = "stylesheet"; | ||
myCss.href = "https://unpkg.com/leaflet@1.3.1/dist/leaflet.css"; | ||
myCss.crossorigin = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's needed.
myScript.src = '//maps.googleapis.com/maps/api/js{% if apiKey %}?key={{ apiKey }}{% endif %}'; | ||
var myCss = document.createElement('link'); | ||
myScript.src = 'https://unpkg.com/leaflet@1.3.1/dist/leaflet.js'; | ||
myScript.crossorigin = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's needed.
dragging: {{ zoom }}, | ||
scrollWheelZoom: {{ scrollWheel }} | ||
}; | ||
var map = L.map(mapId, mapConfig).setView([latitude, longitude], {{ zoom }}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to call method .setView()
it can be set in config:
...
zoom: {{ zoom }},
center: [latitude, longitude],
...
and coords can be cached in variable because are used second time in L.marker()
013ca2d
to
9d4273e
Compare
9d4273e
to
0e6eab9
Compare
Description
When we set latitude and longitude to '0' we should see proper information, not "Not set" message.
Additionally when we did not provide values for latitude and longitude, we still should see a map on the frontend page, with zoom level 1 and coordinates equal 0,0. This PR also changed google maps to openStreetMaps.