Sha256: c0d940c843ad5a763db3e58fa7251c10308524ae1cf38c4276bbeb630a5faeb1

Contents?: true

Size: 896 Bytes

Versions: 13

Compression:

Stored size: 896 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ContentBlocks
    class ParticipatorySpaceSocialNetworksCell < BaseCell
      def show
        return if social_handler_items.blank?

        render
      end

      def social_handler_items
        Decidim::Organization::SOCIAL_HANDLERS.filter_map do |handler|
          if (handler_name = resource.try("#{handler}_handler")).present?
            {
              icon: "#{handler}-line",
              value: link_to(
                handler.capitalize,
                "https://#{handler}.com/#{handler_name}",
                target: "_blank",
                class: "text-secondary underline",
                title: "#{t("show.social_networks_title", scope: "decidim.#{resource.manifest.name}")} #{handler.capitalize}",
                rel: "noopener"
              )
            }
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.4 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.29.0 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.3 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.29.0.rc4 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.29.0.rc3 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.29.0.rc2 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.29.0.rc1 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.2 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.1 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.0 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.0.rc5 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb
decidim-core-0.28.0.rc4 app/cells/decidim/content_blocks/participatory_space_social_networks_cell.rb