Questions tagged [hotwire-rails]

Hotwire-rails is a collection of front-end tools for Rails available since Rails 6 and enabled by default in Rails 7. Use the [Hotwire-rails] tag for questions about Stimulus, Turbo Drive, Turbo Frames and Turbo Streams and especially their usage in Rails. This tag is not for turbo-links (unless the question is about updating to Hotwire). Also be aware that Hotwire and its components are sometimes used outside of Rails.

See also:

228 questions
4
votes
1 answer

Fontawesome icons with jQuery don't seem to work with SVG layers

I have the following bit of code I can run in the browser console that appears to work as expected with all of my Fontawesome icons like so: jQuery(window).on('load', function () { $('.icon-wrapper').click(function() { …
Chris Hough
  • 3,389
  • 3
  • 41
  • 80
4
votes
2 answers

how to redirect a form within turbo_frame?

I need to add a button that persists the data of the following form but that when pressing it resets the view and stays in it, without redirecting to the index of the controller, I have tried an ajax call but I don't know why it didn't work for…
cisco
  • 165
  • 1
  • 8
4
votes
2 answers

Rails hotwire edit link broken after update

I've created a small test app to explore hotwire and I'm having trouble after I click update, my edit button doesn't work any more. I have a jobs model and with-in the show I can click edit and the turbo frame will replace the contents with the edit…
map7
  • 5,096
  • 6
  • 65
  • 128
4
votes
1 answer

Broadcasting to multiple turbo streams with hotwire

I've got hotwire/turbo wired up correctly to do crud operations on a single model on one place of my page, but I'd like to update the same model at the same time in a different location on my page as well. I thought I could just set up two streams…
Vince W
  • 161
  • 2
  • 9
4
votes
1 answer

Hotwire: How to render two partials for a broadcasted object on to two different pages?

Relatively new to Stimulus and Hotwire and wanted to know, "Is there a way to render two different partials for the same broadcasted object on two different pages? I’m trying to render and broadcast an object on a page from one controller to another…
3
votes
1 answer

Ruby on Rails 7 Hotwire Turbo in table html

I have a simple ruby on rails 7 app that uses Hotwire and turbo frames. I have a HTML table on my index page, and would like to make it with turbo frame tag, so that all the actions stay on index page. Here is the index file: <%= turbo_stream_from…
Volkan
  • 494
  • 3
  • 14
  • 32
3
votes
1 answer

Turbo Stream link_to strips out custom attributes in GET request

I'm using Rails 7. I wanted to create a link using link_to that inserts some custom form fields for a many-to-many relation into a form via a hotwired frame elsewhere on the page. In order to customize the form fields generated (setting defaults…
3
votes
0 answers

Turbo-Drive / Turbo-Stream - Clicking on a link does not update browser address bar / history

My page has turbo-drive and turbo-stream enabled. When I click on a link, Turbo-Drive makes AJAX call, receives turbo stream template and replaces the dom as intended. However, the address bar on the browser is not being updated. I have tried these…
Jae Cho
  • 499
  • 5
  • 11
3
votes
1 answer

Turbo stream partial rendering as plain text in Rails 7

I'm building a new Rails 7 app and trying to follow the intended default uses of turbo streams for ajax content replacements (and stimulus where other JS control is needed). This is my first time using Turbo Drive. I'm also using view components…
rdnewman
  • 1,379
  • 20
  • 28
3
votes
1 answer

How to get response body from turbo:submit-end event?

I have a turbo:submit-end event. I want to get the response body when the event fires. Assuming it's possible, how can I do this?
Jason Swett
  • 43,526
  • 67
  • 220
  • 351
3
votes
1 answer

Hotwire/Turbo Frames: why `target: "_top"` isn't requesting pages via fetch?

I'm in the early stages of migrating a Rails app from Turbolinks/rails-ujs (using good ol js.erb views that worked wonders) to Hotwire/Turbo. Picture a traditional users/index.html.erb page with a search form and results table: <%= form_with(scope:…
sandre89
  • 5,218
  • 2
  • 43
  • 64
3
votes
1 answer

Failed to resolve module specifier "stimulus-autocomplete"

Ruby 3.0.3 Rails 7.0.0.alpha2 After following the instructions to install and usage, I launch the server and I received this error: Uncaught TypeError: Failed to resolve module specifier "stimulus-autocomplete". Relative references must start with…
Guillaume
  • 1,437
  • 2
  • 15
  • 17
3
votes
1 answer

How do I use Leaflet in Rails 7?

What I would like to do: I would like to use Leaflet in a Rails 7 app. What I did: I created my rails app and generated a model (with controller and views) called map with only a title. I then added a single map record. I added leaflet to the app…
3
votes
1 answer

Rails Hotwire actioncable stream in nested turbo_frame_tag

Following an article I am trying out Rails Hotwire and want to create a simple blog that works like a single-page app (i.e. using turbo_stream to crud posts and comments without reloading the entire page). I would also like to play a bit with…
GGrassiant
  • 119
  • 4
  • 9
3
votes
2 answers

How to use stripe elements without wepacker in rails 7?

I'm using Rails 7.0.0.alpha2 and I'd like to integrate stripe element (consume from stripe). I don't have a webpacker but I have hotwire together to importmap (responsible for javascript packages) and stimulus(Javascript Framework) I am a bit lost…
1 2
3
15 16