Sha256: 497d9beb73f090d527d0a6b1b2569a276ed0d0138ebac7ed1d96675270e3ca59
Contents?: true
Size: 1.67 KB
Versions: 2
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
decidim-assemblies-0.18.1 | app/cells/decidim/assemblies/assembly_m_cell.rb |
decidim-assemblies-0.18.0 | app/cells/decidim/assemblies/assembly_m_cell.rb |