Sha256: 513265f4acfca598220d37503464e12167ad40f0c03a4183ffc45c33fb7e660c

Contents?: true

Size: 842 Bytes

Versions: 50

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Core
    module HasLocalizedInputFilter
      def self.included(child_class)
        child_class.argument :locale,
                             type: GraphQL::Types::String,
                             description: "Specify the locale to use when searching translated fields, otherwise default organization language will be used",
                             required: false,
                             prepare: lambda { |locale, ctx|
                               unless ctx[:current_organization].available_locales.include?(locale)
                                 raise GraphQL::ExecutionError, "#{locale} locale is not used in the organization"
                               end

                               locale
                             }
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
decidim-core-0.26.8 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.4 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.3 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.7 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.5 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.2 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.1 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.4 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.0 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.3 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.0.rc2 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.27.0.rc1 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.2 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.1 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.0 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.0.rc2 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.26.0.rc1 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.25.2 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.25.1 lib/decidim/api/input_filters/has_localized_input_filter.rb
decidim-core-0.25.0 lib/decidim/api/input_filters/has_localized_input_filter.rb