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

#repositoryBlacklight::AbstractRepository

Deprecated.

provides short-term compatibility with Blacklight 6

Returns:

  • (Blacklight::AbstractRepository)

49
50
51
52
53
54
55
# File 'app/controllers/concerns/hyrax/controller.rb', line 49

def repository
  return super if defined?(super)
  Deprecation.warn("Avoid direct calls to `#repository`; this method" \
                   " provides short-term compatibility to Blacklight 6 " \
                   " clients.")
  blacklight_config.repository
end

#search_builder_classClass<Blacklight::SearchBuilder>

Deprecated.

provides short-term compatibility with Blacklight 6

Returns:

  • (Class<Blacklight::SearchBuilder>)

38
39
40
41
42
43
44
# File 'app/controllers/concerns/hyrax/controller.rb', line 38

def search_builder_class
  return super if defined?(super)
  Deprecation.warn("Avoid direct calls to `#search_builder_class`; this" \
                   " method provides short-term compatibility to" \
                   " Blacklight 6 clients.")
  blacklight_config.search_builder_class
end

#search_results(*args) ⇒ Object

Note:

for Blacklight 6/7 compatibility


58
59
60
61
62
# File 'app/controllers/concerns/hyrax/controller.rb', line 58

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(**search_params) ⇒ Object

Note:

for Blacklight 6/7 compatibility


66
67
68
69
70
71
72
73
# File 'app/controllers/concerns/hyrax/controller.rb', line 66

def search_service(**search_params)
  return super if defined?(super) && search_params.empty?

  search_service_class.new(config: blacklight_config,
                           scope: self,
                           user_params: search_params,
                           search_builder_class: 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