gravitystorm / openstreetmap-website

The Rails application powering OpenStreetMap
http://www.openstreetmap.org/
GNU General Public License v2.0
2 stars 1 forks source link

Explore using hotwire for dynamic pages #181

Open gravitystorm opened 3 years ago

gravitystorm commented 3 years ago

Our codebase has some unusual corners where we build html by hand in javascript code. And the bits where we make async requests to other servers are all hand-crafted too. I also want to bring more dynamic features, like auto-updating notification counts, inline forms etc without having to write a whole bunch of javascript - or worse, head down the massive-js-library path.

Recently a better approach has appeared which seems suited to our needs, called hotwire. In essence it's an opinionated framework built by DHH that sends html over the wire (i.e. html is rendered server-side, like everything else that we have) and most of what we need comes built-in without having to write custom javascript.

The first steps are getting it installed and running, and then maybe tackle something straightforward (like reworking the inbox to use turbo frames) or more useful (updating the mailbox notification count using turbo streams). Then we can work through our existing javascript stuff and refactor it.

gravitystorm commented 3 years ago

Notes so far:

gravitystorm commented 1 year ago

https://dev.to/nejremeslnici/using-hotwire-turbo-in-rails-with-legacy-javascript-17g1 has some good notes for including turbo-frames without needing to get turbo drive working first.