In-App Navbar Notifications

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ม.ค. 2025

ความคิดเห็น • 18

  • @isaiahbot
    @isaiahbot 6 ปีที่แล้ว +3

    2:48 Create Notification model
    6:55 Add associations in Notification model with polymorphic true
    7:35 Add associations to User model with foreign key
    9:15 Add association in the Forum Thread model with through: forum_posts
    9:40 Create a new notification in Forum Posts controller for each recipient
    11:47 Add uniq to array and subtract current_user
    15:25 Create Notifications controller
    16:15 Make scope in model
    16:50 Make index.json .jbuilder in the view
    18:07 Set json.url to make a link
    19:10 Viewing notifications.json
    20:56 Set json.notifiable
    22:26 Add methods
    25:16 Add routes
    25:33 Add mark_as_read method in Notifications Controller
    27:48 Create notifications.js.coffee and create an HTML
    29:18 add data-behavior in HTML
    30:00 add Ajax
    31:23 Add anchor tags in success
    33:38 Add unread count
    34:50 Hide after viewing by adding mark_as_read

  • @SS-li3ft
    @SS-li3ft 2 ปีที่แล้ว

    Can I create the navbar notification using hotwire in rails 7 application?

  • @nikos83
    @nikos83 3 ปีที่แล้ว

    Great! Thanks Chris, any news about React component for showing notifications?

  • @Zenavesta
    @Zenavesta 9 ปีที่แล้ว

    I would love to see more along the React path Chris. That'd be very interesting.

  • @adenaziz3600
    @adenaziz3600 6 ปีที่แล้ว

    if i said.. a notification that says "We are processing your request, please wait", then what is the trackable id?

  • @jonathan364
    @jonathan364 5 ปีที่แล้ว

    So if I want to add notifications to an accepted/denied request. Do I add the notification line to the request page? Is that all or do I have to modify any other file?

  • @desmondocampbell
    @desmondocampbell 2 ปีที่แล้ว

    Would love to see how this would not work if one notification needs to target 1,000+ users.

  • @brendanjones6444
    @brendanjones6444 7 ปีที่แล้ว +1

    I'd love to see this with react.
    One thing to add on to this video is that in index.json.jbuilder, you want to change forum_thread_path to polymorphic_path, just because otherwise it really isn't generic.

  • @stpaquet
    @stpaquet 9 ปีที่แล้ว

    Yeah! Let's do it in React. That would be nice to have both ways.