Sha256: 69215b48b0e3bd1a5cefd4f26eaa2b9f2f4759d77986dd801be0761eb01ee572
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Blacklight class SearchBarPresenter attr_reader :configuration, :view_context, :controller # Set the partial this presenter draws class_attribute :partial self.partial = 'catalog/search_form' def initialize(controller, configuration = view_context.blacklight_config) @controller = controller @view_context = controller.view_context @configuration = configuration end def render view_context.render partial, presenter: self end ## # @return [Boolean] should autocomplete be enabled in the UI def autocomplete_enabled? configuration.autocomplete_enabled.present? && configuration.autocomplete_path.present? end ## # If no search parameters have been given, we should # auto-focus the user's cursor into the searchbox # # @return [Boolean] def autofocus? controller.is_a?(Blacklight::Catalog) && controller.action_name == "index" && !controller.has_search_parameters? end end end
Version data entries
5 entries across 5 versions & 1 rubygems