Sha256: 72b629ab3120f8019aff8213169cba9a648998bca26196baa3ceaeebc3515302
Contents?: true
Size: 763 Bytes
Versions: 10
Compression:
Stored size: 763 Bytes
Contents
# frozen_string_literal: true module Decidim class NotificationsCell < Decidim::ViewModel include Decidim::CellsPaginateHelper include Decidim::Core::Engine.routes.url_helpers helper_method :notifications def show return render :validations if validation_messages.present? render :show end private def validation_messages return [] if notifications_with_resource.present? [t("decidim.notifications.no_notifications")] end def notifications_with_resource @notifications_with_resource ||= notifications.select(&:resource) end def notifications @notifications ||= model.notifications.includes(:resource).order(created_at: :desc).page(params[:page]).per(50) end end end
Version data entries
10 entries across 10 versions & 1 rubygems