Sha256: 90fae9afde76f8eb0707770aa9825b3e7f09c606442abf8e8bcce6d2cbb13b23

Contents?: true

Size: 909 Bytes

Versions: 22

Compression:

Stored size: 909 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Initiatives
    # Exposes the initiative type text search so users can choose a type writing its name.
    class InitiativesTypeScopesController < Decidim::Initiatives::ApplicationController
      helper_method :scoped_types

      # GET /initiative_type_scopes/search
      def search
        enforce_permission_to :search, :initiative_type_scope
        render layout: false
      end

      private

      def scoped_types
        @scoped_types ||= if initiative_type.only_global_scope_enabled?
                            initiative_type.scopes.where(scope: nil)
                          else
                            initiative_type.scopes
                          end
      end

      def initiative_type
        @initiative_type ||= InitiativesType.where(organization: current_organization).find(params[:type_id])
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
decidim-initiatives-0.29.1 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.4 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.27.9 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.29.0 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.3 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.27.8 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.29.0.rc4 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.29.0.rc3 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.29.0.rc2 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.29.0.rc1 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.2 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.27.7 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.1 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.27.6 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.26.10 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.26.9 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.0 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.27.5 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.0.rc5 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb
decidim-initiatives-0.28.0.rc4 app/controllers/decidim/initiatives/initiatives_type_scopes_controller.rb