Skip to main content

Subscribe to GoRails to get access to this episode and all other pro episodes, and new awesome content every month.

Subscribe Now
Only $19/month

Unlimited access. Cancel anytime.

15 Stimulus JS:

Stimulus JS Twitter UI: Part 2

Episode 232 · February 28, 2018

Build out a Twitter UI with a tweet form and inline editing using Stimulus JS



Subscribe or login to view the transcript for this episode.


Great content, as always.  An idea for another Stimulus screencast: reimplement
the 'Using VueJS for Nested Forms in Rails' series in Stimulus.

I think that a great topic to cover would be a slick search page with no refreshes. Maybe just something simple like only showing 10 tweets at a time, but adding a search bar which, when you type into it, fetches tweets matching that search and replaces the content on the page. Could also be a neat chance to throw in some basic CSS Animations!
I think this is a great idea. Perhaps redoing the '@mention' episode you did many months ago, but using Stimulus -- so you do autocomplete on some character trigger or in a search box -- would be a cool thing to see....I think.

Also, Stimulus and other popular gems (say SimpleForm).

Hi, I just subscribed to learn a bit more about Stimulus and specifically how to integrate it with ActionCable which you mentioned at the start of this two part episode. Are you planning a part 3 to cover this or did I misunderstand? I don't mean this as a criticism as the episodes are great as they are but this was one area in particular I was interested in.

I have an application which already uses ActionCable to allow me to push content to the UI when models change on the server but if I am going to use Stimulus I need a way to achieve the same thing. I have managed to get this to work by subscribing to any relevant ActionCable channels in the 'connect' method but wondered if this was the best approach. Any advice would be gratefully received. 

I really like what I've seen on your screencasts so far and look forward to working my way through the other episodes. Great work! Many thanks, Craig.
+1, a Stimulus with ActionCable video would be great.

Is there any reason we can't put the data action as a button click on the submit button instead of the ajax:beforeSend on the actual form? I can't seem to get the latter to correctly register. 

@Chris I found your Stimulus github issue but I also don't undertsand why ajax:beforeSend is required to get preventDefault to work:

"this is a remote form using rails ujs, and we have to use the AJAX before send event, and we'll pass that into our tweet form submit action."

In my case I'm simply trying to use preventDefault with a remote link but I can't get it to work as expected.

Login or create an account to join the conversation.