Sha256: 5b1a85683f54f73bb799e8ba2dddd3df328173e40be6a8f12f925a937255a08b
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module Decidim module Admin class ContentBlockCell < Decidim::ViewModel include Decidim::IconHelper include Decidim::ContentBlocks::HasRelatedComponents delegate :public_name_key, :has_settings?, :component_manifest_name, to: :model delegate :content_block_destroy_confirmation_text, to: :controller def edit_content_block_path raise "#{self.class.name} is expected to implement #edit_content_block_path" end def content_block_path raise "#{self.class.name} is expected to implement #content_block_path" end def component @component ||= if component_manifest_name.present? components = components_for(model) component_id = model.settings.try(:component_id) components = components.where(id: component_id) if component_id.present? components.first if components.one? end end def name return I18n.t(public_name_key) if component.blank? "#{I18n.t(public_name_key)} (#{translated_attribute(component&.name)})" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems