Sha256: fc0bb768408a4075cfeac1b6d3c2d08999a77bd634d17b70280493280ea94b2e

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # This cell renders a notification from a notifications collection

  class NotificationCell < Decidim::ViewModel
    include Decidim::IconHelper
    include Decidim::Core::Engine.routes.url_helpers

    def show
      if notification.event_class_instance.try(:hidden_resource?)
        render :moderated
      else
        render :show
      end
    end

    def notification_title
      notification.event_class_instance.notification_title
    rescue StandardError
      I18n.t("decidim.notifications.show.missing_event")
    end

    private

    def notification
      @notification ||= Decidim::NotificationPresenter.new(model)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/cells/decidim/notification_cell.rb
decidim-core-0.27.8 app/cells/decidim/notification_cell.rb
decidim-core-0.27.7 app/cells/decidim/notification_cell.rb