Sha256: c34ab780207b401f884119f76bc960b6e526340d3c93c4209cd9efe390f53c4f
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blacklight-7.0.0.rc1 | app/presenters/blacklight/search_bar_presenter.rb |