Looking for collaborators on a TurboRouter gem

Hey folks.

I am trying to extract some useful patterns I have come up with using Hotwilre/Turbo into a gem I am calling TurboRouter. It greatly reduces the amount of boilerplate code you have to write if you want your standard controller actions to respond both to turbo_frame requests for internal navigation as well as normal requests for navigating to a resource from outside.

Take a look at this module where most the logic is implemented: TurboRouter/controller.rb at main · WriterZephos/TurboRouter · GitHub

The idea is that once you include that module in your controller, you can turn this:

@post = Post.find(params[:id])
respond_to do |format|
  format.html do |html|
    html.turbo_frame do
      render template: "show", layout: "turbo_frame_wrapper_layout"
    end
    html.page do
      render template: "show", layout: "application"
    end
  end
end

Into this:

@post = Post.find(params[:id])
turbo_router

Anyway I am hoping this could be pretty useful to others but all my experience is in developing rails apps, not gems, and putting this into a gem is turning out to be a little outside my wheelhouse.

I would love to find some collaborators to help me turn this into a useful gem. The repo is here: TurboRouter/controller.rb at main · WriterZephos/TurboRouter · GitHub

Let me know if you can contribute and any feedback you have.

1 Like