Sha256: d04f1795fb7b30561aad1f2ab68552b21a0ebf065cf5aafee55993166f2ccd32
Contents?: true
Size: 1.06 KB
Versions: 6
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Decidim # Renders a collection of activities using a different cell for # each one. class ActivitiesCell < Decidim::ViewModel include Decidim::CardHelper include Decidim::Core::Engine.routes.url_helpers # Since we are rendering each activity separatedly we need to trigger # BatchLoader in order to accumulate all the ids to be found later. def show return if activities.blank? render end def activity_cell_for(activity) opts = options.slice(:id_prefix, :hide_participatory_space).merge( show_author: (context[:user] != activity.user) ) cell "#{activity.resource_type.constantize.name.underscore}_activity", activity, context: opts rescue NameError cell "decidim/activity", activity, context: opts end def activities @activities ||= model.map do |activity| activity.organization_lazy activity.resource_lazy activity.participatory_space_lazy activity.component_lazy activity end end end end
Version data entries
6 entries across 6 versions & 1 rubygems