Sha256: d428c502ec7614e22395cbfe6dcaa3e87d700d0595a6a1f3abe41e8ca788b2ee

Contents?: true

Size: 834 Bytes

Versions: 18

Compression:

Stored size: 834 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  ##
  # Search configurations helpers
  module SearchConfigurationsHelper
    ##
    # Translate a sort field configuration into
    # a complete description of the sort
    def translate_sort_fields(sort_config)
      sort_description = sort_config[:sort_description] if sort_config[:sort_description]

      sort_description ||= sort_config[:sort].split(',').map do |sort|
        sort_field, sort_order = sort.split(' ')
        safe_join([
                    t(:"spotlight.search_configurations.sort.keys.#{sort_field.strip}", default: sort_field.humanize.downcase),
                    t(:"spotlight.search_configurations.sort.keys.#{sort_order.strip}", default: '')
                  ], ' ')
      end.to_sentence if sort_config[:sort]

      sort_description
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.0.0.alpha.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.13.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.12.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.12.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.11.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.10.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.9.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.8.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.7.2 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.7.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.7.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.6.1.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.6.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.6.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.5.2 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.5.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-2.5.0 app/helpers/spotlight/search_configurations_helper.rb