Sha256: 30be7fac65a2c57e2d89f26c54ece886c4d70901abbb94688ddfdb0635a9d0c5
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 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::IconHelper include Decidim::Core::Engine.routes.url_helpers delegate :current_organization, to: :controller # Since we're 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? activities.map do |activity| activity.organization_lazy activity.resource_lazy activity.participatory_space_lazy activity.component_lazy end render end def activity_cell_for(activity) options = { show_author: (context[:user] != activity.user) } cell "#{activity.resource_type.constantize.name.underscore}_activity", activity, context: options rescue NameError cell "decidim/activity", activity, context: options end def activities model end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.16.1 | app/cells/decidim/activities_cell.rb |
decidim-core-0.16.0 | app/cells/decidim/activities_cell.rb |