Questions tagged [hotwire]

45 questions
0
votes
1 answer

Rails 7 - Stimulus Controller connection or/and syntax error

My controller: import { Controller } from "@hotwired/stimulus"; import consumer from "channels/consumer"; export default class extends Controller { static targets = ["users", "roomId"]; connect() { console.log(""); this.subscription =…
Wordica
  • 2,427
  • 3
  • 31
  • 51
0
votes
0 answers

Micronaut Views Turbo Streams

How do we render multiple Turbo Streams in the response? the examples which I have run seem to show only one like so: @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Post("/{id}/messages") HttpResponse save(@PathVariable Long id, …
Oreoluwa
  • 399
  • 3
  • 15
0
votes
1 answer

Hotwire turbo with turbo-method: :delete and redirect_to

My test erb: <%= link_to 'Test', test_path, data: { turbo_method: :delete } %> My test controller method looks like this: def test redirect_to root_path, status: :see_other end Simple as that.. it responds with a turbostream and appends the…
Oliver
  • 801
  • 13
  • 26
0
votes
0 answers

Dropzone is returning JSON response instead of turbo_stream - Rails 7

I am using Dropzone with Rails 7 (Stimulus JS). I followed the documentation and somehow the image drag and drop is working fine but as I am integrating dropzone in existing form it is returning me the data in JSON response. def create …
0
votes
1 answer

Rails view not displaying partial - "response has no matching element"

I've got an index page with a search which mostly works, aside from when there are no results, which is when I get the error:- response has no matching element I don't get this when there are search results. Do I need to…
s89_
  • 1,533
  • 3
  • 25
  • 40
0
votes
0 answers

Kaminari including POST params in page links after turbo create

I have a set of pagination links in a table which gets refreshed in POST requests, with a turbo stream. My problem is that if I click a pagination link immediately after I create a new Car record, the pagination links change to include the params of…
s89_
  • 1,533
  • 3
  • 25
  • 40
0
votes
1 answer

Sorting table by nested models attribute in Rail with Turbo Frames

I am creating a table of Employees and I would like to sort by full_rate_pence, which is an attribute of HourlyRate. Each employee has_many hourly_rates which form a history of pay increases or decreases. The problem is trying to access the nested…
0
votes
0 answers

Why is turbo rails remove action not removing this div and returning this error?

I've got a Rails 6 app using turbo-rails. In my HTML I'm rendering a div like so
When I click a button_to tag I trigger the destroy action that runs a destroy.turbo_stream.erb view file <%= turbo_stream.remove…
ilrock
  • 573
  • 8
  • 24
0
votes
0 answers

Trigger stimulus event when target added/removed from DOM

I have what is essentially a form with multiple pages, where there is a partial which renders the form content for each page inside of a partial that contains the header, footer, "next" button. I need my "Next" button to respond dynamically to each…
0
votes
2 answers

Does installing hotwire in a rails project require Javascript?

My OS is Linux and my distribution is debian-bullseye. My ruby version is 3.1 and my rails version is 7. I created a rails project rails new chat --skip-javascript cd chat/ I installed hotwire bundle add hotwire-rails rails hotwire:install And I…
Chiara Ani
  • 918
  • 7
  • 25
0
votes
2 answers

Turbo Stream broadcast_replace_to is removing the turbo_frame_tag

Code snippets: application.html.erb: <%= turbo_stream_from current_user, "counter" %> <% if current_user%> <%= render partial: "users/counter", locals: { user: current_user } %> <% end %> users/_counter.html.erb: <%= turbo_frame_tag…
septerr
  • 6,445
  • 9
  • 50
  • 73
0
votes
1 answer

Reset file field through stimulus controller

I have a form which is submitted through stimulus controller. #form.html.haml = form_with url: my_url, multipart: true, data: { turbo_frame: 'document_table_content', turbo_action: 'advanced' } do |f| = f.file_field 'documents[files]', multiple:…
0
votes
1 answer

form_with and stimulus with hotwire doesn't work (Rails 7)

Select field with form_with, Stimulus and Hotwire, and Rails 7 I want to see a message in the console once I change the select value. I'm using Hotwire and Rails 7 but it doesn't work. Code. _form.html.erb <%= form_with model: [@framework,…
0
votes
1 answer

Refresh (variable) part of an html page with hotwire (Flask app)

Context I am building a simple "todo" flask app with an SQLAchemy database. The tasks are sorted by sections (check the image below to see how it is organized). Once I implemented all the functionalities I wanted, I ran into the issue which was the…
AnthoGr
  • 45
  • 1
  • 7
0
votes
1 answer

Login flow with Hotwire

I'm currently developing my first application with Rails and Hotwire. It includes a comment form visible to all users. When unauthenticated users submit it, I'd like to open the login form (managed by Devise) in a modal on top of the form. Currently…
davidg
  • 651
  • 1
  • 7
  • 18
1 2
3