[openstreetmap/openstreetmap-website] Introduce sidebar content get/set functions (PR #3773)
Anton Khorev
notifications at github.com
Mon Oct 31 12:31:23 UTC 2022
@AntonKhorev commented on this pull request.
> -
- if (xhr.getResponseHeader("X-Page-Title")) {
- var title = xhr.getResponseHeader("X-Page-Title");
- document.title = decodeURIComponent(title);
- }
-
- $("head")
- .find("link[type=\"application/atom+xml\"]")
- .remove();
-
- $("head")
- .append(content.filter("link[type=\"application/atom+xml\"]"));
-
- $("#sidebar_content").html(content.not("link[type=\"application/atom+xml\"]"));
-
+ OSM.setSidebarContent([xhr.getResponseHeader("X-Page-Title"), xhr.responseText]);
The idea is for the get function to be able to receive as an argument whatever was returned by the set function.
Get() needs to return two things. They need to be packed into something before being returned. Currently it's easy to imagine how you can unpack them and pass as individual arguments to set(). What if I add more things? What if I decide that with more things it's better to return an object from get()? I don't want to unpack such objects for set() arguments.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3773#discussion_r1009359681
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3773/review/1161795146 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20221031/759fa52a/attachment.htm>
More information about the rails-dev
mailing list