[openstreetmap/openstreetmap-website] Instantiate js controllers only once needed (PR #6295)

Anton Khorev notifications at github.com
Tue Aug 26 15:10:12 UTC 2025


@AntonKhorev commented on this pull request.



> -  addNoteButton.on("click", function (e) {
-    e.preventDefault();
-    e.stopPropagation();
-
-    if ($(this).hasClass("disabled")) return;
-
-    OSM.router.route("/note/new");
-  });

Do the event handlers need to to be moved to another file? Why wouldn't adding this on the top of `new_note.js` work?

```js
$(function () {
  $(".control-note .control-button").on("click", function (e) {
    e.preventDefault();
    e.stopPropagation();

    if ($(this).hasClass("disabled")) return;

    OSM.router.route("/note/new");
  });
});
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6295#pullrequestreview-3156112632
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6295/review/3156112632 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250826/13f74570/attachment.htm>


More information about the rails-dev mailing list