Sha256: 9b5d0c6fc388e5d918c4c345be58f4ce0da33293e84da81ee1b0b307e4ff887d

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

class NotificationComponent < BaseComponent
  def initialize(notification: nil)
    @notification = notification
    super
  end

  erb_template <<~ERB
    <div class="notification d-flex justify-content-between <%= 'unseen' if @notification.unseen? %>"
         id="<%= dom_id(@notification) %>" data-id="<%= @notification.id %>">
      <div>
        <%= @notification.message.html_safe %>
      </div>
      <div class="notification--time d-flex flex-column justify-content-end text-body-tertiary text-end ms-4">
        <div>
          hace
          <%= distance_of_time_in_words @notification.created_at, Time.zone.now %>
        </div>
        <div>
          <a href="javascript:void" class="link-opacity-50" data-action="notifications#markAsUnseen">Marcar como no leĆ­do</a>
        </div>
      </div>
    </div>
  ERB
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_rails-7.0.8.pre.alpha.105 pg_engine/app/components/notification_component.rb
pg_rails-7.0.8.pre.alpha.104 pg_engine/app/components/notification_component.rb