Sha256: 6ef3cb44d7e313a02e7d6cc622af26715cef7e920a6b83daabfe2dffe51e68c8

Contents?: true

Size: 1.15 KB

Versions: 15

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  # A controller concern to enable flagging capabilities to its resources. Only
  # affects the UI, so make sure you check the controller resources implement
  # the `Decidim::Reportable` model concern.
  module HasParticipatorySpaceContentBlocks
    extend ActiveSupport::Concern

    included do
      delegate :content_blocks_scope_name, to: :current_participatory_space_manifest

      helper_method :active_content_blocks

      def active_content_blocks
        @active_content_blocks ||= if current_participatory_space.present?
                                     Decidim::ContentBlock.published.for_scope(
                                       content_blocks_scope_name,
                                       organization: current_organization
                                     ).where(
                                       scoped_resource_id: current_participatory_space.id
                                     )
                                   else
                                     Decidim::ContentBlock.none
                                   end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
decidim-core-0.29.2 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.5 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.29.1 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.4 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.29.0 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.3 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.29.0.rc4 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.29.0.rc3 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.29.0.rc2 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.29.0.rc1 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.2 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.1 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.0 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.0.rc5 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb
decidim-core-0.28.0.rc4 app/controllers/concerns/decidim/has_participatory_space_content_blocks.rb