diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 89d6f656..725ef72e 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -19,7 +19,7 @@ class NotificationsController < ApplicationController respond_to do |format| format.html - format.js { render layout: false } + format.turbo_stream end end diff --git a/app/views/notifications/index.haml b/app/views/notifications/index.haml index 313c3687..6369aab3 100644 --- a/app/views/notifications/index.haml +++ b/app/views/notifications/index.haml @@ -1,27 +1,25 @@ -%ul.list-unstyled#notifications - - if @notifications.count.zero? - %li.card.text-center - .card-body - .notifications--none - %i.fa.fa-bell-o.notification__bell-icon - %p - - if params[:type] == 'all' - = t(".none_filtered") - - else - = t(".none") - - else - - @notifications.each do |notification| - %li.card += turbo_frame_tag "notification" do + %ul.list-unstyled#notifications + - if @notifications.count.zero? + %li.card.text-center .card-body - .media - = render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification: notification - - - unless @notifications.count.zero? - = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type] + .notifications--none + %i.fa.fa-bell-o.notification__bell-icon + %p + - if params[:type] == 'all' + = t(".none_filtered") + - else + = t(".none") + - else + - @notifications.each do |notification| + %li.card + .card-body + .media + = render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification: notification - if @more_data_available - .d-flex.justify-content-center.justify-content-sm-start - %button.btn.btn-light#load-more-btn{ type: :button, data: { last_id: @notifications_last_id } } + .d-flex.justify-content-center.justify-content-sm-start#paginator + = button_to notifications_path(last_id: @notifications_last_id, type: params[:type]), class: "btn btn-light" do = t("voc.load") - provide(:title, generate_title(t(".title"))) diff --git a/app/views/notifications/index.js.erb b/app/views/notifications/index.js.erb deleted file mode 100644 index 6ab1e1fc..00000000 --- a/app/views/notifications/index.js.erb +++ /dev/null @@ -1,8 +0,0 @@ -$('#notifications').append('<% @notifications.each do |notification| - %>