Sha256: 210a6e79cccf83ca3183da603b5093858bfc1aef937e6deff760b14ca7722374

Contents?: true

Size: 864 Bytes

Versions: 58

Compression:

Stored size: 864 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]

      if sort_config[:sort]
        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
      end

      sort_description
    end
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
blacklight-spotlight-3.5.0.3 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.6.0.beta6 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.6.0.beta5 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.6.0.beta4 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.6.0.beta3 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.6.0.beta1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.5.0.2 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.5.0.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.5.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.4.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.4 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.3 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.2.2 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.2.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.2 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.1 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.4.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.3.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.2.0 app/helpers/spotlight/search_configurations_helper.rb
blacklight-spotlight-3.1.0 app/helpers/spotlight/search_configurations_helper.rb