docbrown/app/views/notifications/_notifications_list.html.erb
Jeremy Friesen a65954107f
Refactoring to add helper method (#16064)
* Refactoring to add helper method

Prior to this commit, we made view level calls to service modules.  This
refactor provides convenience methods on the model.

Furthermore, it addresses a few Rubocop violations that "come along for
the ride."

* Ensuring cached entity squaks like User

* Fixing broken spec

* Fixing typo
2022-01-12 11:21:44 -05:00

23 lines
923 B
Text

<% @notifications.each do |notification| %>
<div
class="mb-2 spec-notification <%= "unseen" unless notification.read? %>"
data-notification-id="<%= notification.id %>">
<%= render notification.notifiable_type.downcase.to_s, notification: notification %>
</div>
<% rescue => e %>
<% Honeybadger.notify(e, context: { notification_id: notification.id }) %>
<div class="align-center p-9 py-10 color-base-80 crayons-card mb-2">
<h2 class="fw-bold fs-l"><%= t("views.notifications.error.subtitle") %></h2>
<p class="color-base-60 pt-2"><%= t("views.notifications.error.desc") %></p>
</div>
<% end %>
<% if @notifications.any? %>
<% sub_path = params[:org_id].present? ? "#{params[:filter]}/#{params[:org_id]}" : params[:filter].to_s %>
<div
class="notifications-paginator"
data-pagination-path="/notifications/<%= sub_path %>?offset=<%= @notifications.last.id %>"></div>
<% end %>