Ruby on Rails #100 Browser tab title notifications

preview_player
Показать описание
Do you like see the "new notifications count" in the LinkedIn browser tab?
In this episode we will update the browser tab title, if the application user has new unsee notifications.
We will use StimulusJS to add a blinking effect.
We will use Turbo Stream Broadcasts to update the notifications count in all browser tabs.
We will also add an "undead" symbol to the application thumbnail.

In the context of StimulusJS, we will leverage setInterval and usage of disconnect().

Improvements you can do yourself:
- Scope notifications per user
- Mark notifications as "seen" when accessing "notifications#show" page/controller
- Broadcast notifications count when notification is deleted or seen

0:00 Feature request
0:19 What we will build
1:02 Initial setup
1:35 conditional thumbnails
4:20 conditional notifications count
5:05 StimulusJS - blinking page title
10:40 Broadcast update thumbnail (no page refresh)
15:52 Summary
Рекомендации по теме
Комментарии
Автор

Цікаво б було побачити реалізацію динамічних зображень і тексту для табок у випадку використання у проекту gem "meta-tags"....

ledockol
Автор

Гарна ідея! Браво.
Беру на озброєння.
Дякую.

Прим. Трохи можо скоротити)
Notification.where.not(seen: true)

ledockol
Автор

that's not me, ,I'm ruby villarubia

irenerocabomuyalde