Sha256: a9bdd28336a54118b130308f9d00a62c80928cb748bd2dc72436953affd8e39b

Contents?: true

Size: 839 Bytes

Versions: 50

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Core
    module HasLocalizedInputSort
      def self.included(child_class)
        child_class.argument :locale,
                             type: GraphQL::Types::String,
                             description: "Specify the locale to use when ordering 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.29.1 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.4 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.27.9 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.29.0 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.3 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.27.8 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.29.0.rc4 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.29.0.rc3 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.29.0.rc2 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.29.0.rc1 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.2 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.27.7 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.1 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.27.6 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.26.10 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.26.9 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.0 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.27.5 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.0.rc5 lib/decidim/api/input_sorts/has_localized_input_sort.rb
decidim-core-0.28.0.rc4 lib/decidim/api/input_sorts/has_localized_input_sort.rb