Sha256: f65edf3f567b63ce12fc9c34a94fef2012c676d8d9946cc7619217a851e170ea

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcessGroups
    module ContentBlocks
      class TitleCell < Decidim::ViewModel
        include Decidim::SanitizeHelper
        include Decidim::IconHelper
        include Decidim::TwitterSearchHelper

        delegate :group_url, to: :participatory_process_group

        def participatory_process_group
          @participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
        end

        def hashtag_text
          @hashtag_text ||= decidim_html_escape(participatory_process_group.hashtag || "")
        end

        def has_hashtag?
          hashtag_text.present?
        end

        def has_group_url?
          group_url.present?
        end

        def meta_scope
          @meta_scope ||= translated_attribute(participatory_process_group.meta_scope)
        end

        def has_meta_scope?
          meta_scope.present?
        end

        def group_url_text
          group_uri.host + group_uri.path
        end

        def decidim_participatory_processes
          Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
        end

        def participatory_processes_count
          @participatory_processes_count ||= participatory_process_group.participatory_processes.count
        end

        private

        def group_uri
          @group_uri = URI.parse(group_url)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.27.0 app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb
decidim-participatory_processes-0.26.3 app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb
decidim-participatory_processes-0.27.0.rc2 app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb
decidim-participatory_processes-0.27.0.rc1 app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb
decidim-participatory_processes-0.26.2 app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb
decidim-participatory_processes-0.26.1 app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb