Module: Hyrax::Controller

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/hyrax/controller.rb

Overview

Note:

private methods within this module are normally still “public API”, since they are meant to be called by inheriting controllers.

A mixin for Hyrax support methods. This is meant to be included in ‘ApplicationController`.

Instance Method Summary collapse

Instance Method Details

#default_url_optionsObject

Ensure that the locale choice is persistent across requests



31
32
33
# File 'app/controllers/concerns/hyrax/controller.rb', line 31

def default_url_options
  super.merge(locale: I18n.locale)
end

#search_results(*args) ⇒ Object

Note:

for Blacklight 6/7 compatibility



36
37
38
39
40
# File 'app/controllers/concerns/hyrax/controller.rb', line 36

def search_results(*args)
  return super if defined?(super) # use the upstream if present (e.g. in BL 6)

  search_service(*args).search_results
end

#search_service(*args, **search_params) ⇒ Object

Note:

for Blacklight 6/7 compatibility



44
45
46
47
48
49
50
51
52
# File 'app/controllers/concerns/hyrax/controller.rb', line 44

def search_service(*args, **search_params)
  search_params.merge!(args.last) if args.last.is_a?(Hash)
  return super if defined?(super) && search_params.empty?

  search_service_class.new(config: blacklight_config,
                           scope: self,
                           user_params: search_params,
                           search_builder_class: blacklight_config.search_builder_class)
end

#user_root_pathObject

Provide a place for Devise to send the user to after signing in



26
27
28
# File 'app/controllers/concerns/hyrax/controller.rb', line 26

def user_root_path
  hyrax.dashboard_path
end