Sha256: d5e41b53905d58e48615c4d8f3695a81b44563a24b362b3c39c0b133faf4ca84
Contents?: true
Size: 1.67 KB
Versions: 4
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true module Decidim module Assemblies # This cell renders the Medium (:m) assembyl card # for an given instance of an Assembly class AssemblyMCell < Decidim::CardMCell include Decidim::ViewHooksHelper # Needed for the view hooks def current_participatory_space model end private def has_image? true end def has_children? model.children.any? end def resource_path Decidim::Assemblies::Engine.routes.url_helpers.assembly_path(model) end def resource_image_path model.hero_image.url end def statuses return super unless has_children? [:creation_date, :follow, :children_count] end def children_count_status content_tag( :strong, t("layouts.decidim.assemblies.index.children") ) + " " + children_assemblies_visible_for_user end def children_assemblies_visible_for_user assemblies = model.children.published if current_user return assemblies.count.to_s if current_user.admin assemblies.visible_for(current_user).count.to_s else assemblies.public_spaces.count.to_s end end def resource_icon icon "assemblies", class: "icon--big" end def has_assembly_type? model.assembly_type.present? end def assembly_type if model.assembly_type == "others" translated_attribute(model.assembly_type_other) else t("assembly_types.#{model.assembly_type}", scope: "decidim.assemblies").to_s end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems