Appease the dog overlords

This commit is contained in:
Karina Kwiatek 2023-03-10 21:08:28 +01:00
parent c9c458252b
commit 80d8bebe57
3 changed files with 20 additions and 21 deletions

View File

@ -26,12 +26,12 @@ class NotificationsController < ApplicationController
end end
def read def read
current_user.notifications.where(new: true).update_all(new: false) current_user.notifications.where(new: true).update_all(new: false) # rubocop:disable Rails/SkipsModelValidations
respond_to do |format| respond_to do |format|
format.turbo_stream do format.turbo_stream do
render "navigation/notifications", locals: { notifications: [], notification_count: nil } render "navigation/notifications", locals: { notifications: [], notification_count: nil }
end end
end end
end end

View File

@ -31,7 +31,7 @@
%span.badge= notification_count %span.badge= notification_count
.dropdown-menu.dropdown-menu-end.notification-dropdown .dropdown-menu.dropdown-menu-end.notification-dropdown
%turbo-frame#notifications-dropdown-list %turbo-frame#notifications-dropdown-list
= render 'navigation/dropdown/notifications', notifications:, notification_count: nil = render "navigation/dropdown/notifications", notifications:, notification_count: nil
%li.nav-item.d-none.d-sm-block{ data: { bs_toggle: 'tooltip', bs_placement: 'bottom' }, title: t('.ask_question') } %li.nav-item.d-none.d-sm-block{ data: { bs_toggle: 'tooltip', bs_placement: 'bottom' }, title: t('.ask_question') }
%a.nav-link{ href: "#", name: "toggle-all-ask", data: { bs_target: "#modal-ask-followers", bs_toggle: :modal, hotkey: "n" } } %a.nav-link{ href: "#", name: "toggle-all-ask", data: { bs_target: "#modal-ask-followers", bs_toggle: :modal, hotkey: "n" } }
%i.fa.fa-pencil-square-o %i.fa.fa-pencil-square-o

View File

@ -1,19 +1,18 @@
.dropdown-menu.dropdown-menu-end.notification-dropdown{ id: "rs-#{size}-nav-notifications" } - if notifications.count.zero?
- if notifications.count.zero? %a.dropdown-item.text-center{ href: notifications_path('all') }
%a.dropdown-item.text-center{ href: notifications_path('all') } %i.fa.fa-fw.fa-chevron-right
%i.fa.fa-fw.fa-chevron-right = t(".all")
= t(".all") .dropdown-item.text-center.p-2
.dropdown-item.text-center.p-2 %i.fa.fa-bell-o.notification__bell-icon
%i.fa.fa-bell-o.notification__bell-icon %p= t(".none")
%p= t(".none") - else
- else %a.dropdown-item.text-center{ href: notifications_path }
%a.dropdown-item.text-center{ href: notifications_path } %i.fa.fa-fw.fa-chevron-right
%i.fa.fa-fw.fa-chevron-right = t(".new")
= t(".new") = link_to notifications_read_path, class: "dropdown-item text-center", data: { turbo_stream: true, turbo_method: :post } do
= link_to notifications_read_path, class: "dropdown-item text-center", data: { turbo_stream: true, turbo_method: :post } do %i.fa.fa-fw.fa-check-double
%i.fa.fa-fw.fa-check-double = t(".mark_as_read")
= t(".mark_as_read") - notifications.each do |notification|
- notifications.each do |notification| .dropdown-item
.dropdown-item = render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification:
= render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification: notification