Matthew Lang avatar

Using Stimulus in PenMuse

It’s been a while since I dabbled in a bit of JavaScript. It’s not that I don’t like programming in JavaScript, it is growing on me, it’s just I’ve never found a real use case for it in a web application. The thing about JavaScript though is that there are so many great frameworks available that mean you often don’t have to write any of the curly bracket stuff.

Vue.js has been on my radar for a while but what has really grabbed my interest has been the release of Stimulus.

For a lot of web applications I work on, I don’t want to re-write a whole view for a particular framework, I just want to enhance a part of that view. Both the above mentioned frameworks do this, but I decided to try and use Stimulus with a web application of my own just for fun.

The copy to clipboard is a nice example to start from in the Stimulus handbook and so I started with this basic example by adding a copy to clipboard button when displaying a writing prompt in PenMuse. Not only was it good to broaden my reach beyond the Rails code that I am used to writing, I also got to experiment with WebPacker as well.

The final results are good and there was a few hiccups along the way in trying to copy the prompt from an input element that didn’t interfere with the user interface.

I did at one point create an input elemement on the fly to copy the prompt from when the button was pressed, but it jerked the screen up and down on tablet devices as it was copying the prompt. Horrible.

I decided to settle on using an input group so that you can partially see the prompt being copied. It’s not ideal, but it’s working and it doesn’t mess with the screen in anyway on different devices.

I’ve still got some adjustments to make for smaller devices like stacking the buttons on the home page so that they appear as a column but that will come later in the week.

Feels good to be starting another Rails project. I’m hoping this one runs for a while, but I really need to spend more time on throwaway Rails projects and learning more about things like ActionCable and Turbolinks.

RSS discovery

A common observation around the slow uptake of RSS readers is that RSS is still something that people don’t understand.

RSS readers often rely on the user to add the feeds that they want, but unless users know where to look then users may be turned off by an RSS reader. A blank page with no suggested or recommended feeds in it isn’t going to demonstrate what an RSS reader can do.

I’ve noticed that podcasting apps like Overcast and Pocketcasts include discovery sections that show you podcasts that you can subscribe too. They provide recommended and categories sections that people can click and find out more information about that podcast. If they like it they can subscribe.

Perhaps it’s not only about adding subscribe buttons to our sites but also making RSS readers more user friendly by adding RSS discovery so that people can find the content they want.

_If my memory serves me right, Feedly does include such a discovery feature, so thumbs up to them! _