Module: Blacklight::DefaultComponentConfiguration::ClassMethods
- Defined in:
- app/controllers/concerns/blacklight/default_component_configuration.rb
Instance Method Summary collapse
-
#add_nav_action(name, opts = {}) ⇒ Object
Add a partial to the header navbar.
-
#add_results_collection_tool(name, opts = {}) ⇒ Object
Add a tool to be displayed for the list of search results themselves.
-
#add_results_document_tool(name, opts = {}) ⇒ Object
Add a tool to be displayed for each document in the search results.
-
#add_show_tools_partial(name, opts = {}) ⇒ Object
Add a partial to the tools for rendering a document.
Instance Method Details
#add_nav_action(name, opts = {}) ⇒ Object
Add a partial to the header navbar.
90 91 92 |
# File 'app/controllers/concerns/blacklight/default_component_configuration.rb', line 90 def add_nav_action(name, opts = {}) blacklight_config.add_nav_action(name, opts) end |
#add_results_collection_tool(name, opts = {}) ⇒ Object
Add a tool to be displayed for the list of search results themselves.
84 85 86 |
# File 'app/controllers/concerns/blacklight/default_component_configuration.rb', line 84 def add_results_collection_tool(name, opts = {}) blacklight_config.add_results_collection_tool(name, opts) end |
#add_results_document_tool(name, opts = {}) ⇒ Object
Add a tool to be displayed for each document in the search results.
78 79 80 |
# File 'app/controllers/concerns/blacklight/default_component_configuration.rb', line 78 def add_results_document_tool(name, opts = {}) blacklight_config.add_results_document_tool(name, opts) end |
#add_show_tools_partial(name, opts = {}) ⇒ Object
Add a partial to the tools for rendering a document
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/controllers/concerns/blacklight/default_component_configuration.rb', line 42 def add_show_tools_partial(name, opts = {}) blacklight_config.add_show_tools_partial(name, opts) return if method_defined?(name) || opts[:define_method] == false # Define a simple action handler for the tool define_method name do @response, @documents = action_documents if request.post? && opts[:callback] && (opts[:validator].blank? || self.send(opts[:validator])) self.send(opts[:callback], @documents) flash[:success] ||= I18n.t("blacklight.#{name}.success", default: nil) respond_to do |format| format.html do return render "#{name}_success", layout: false if request.xhr? redirect_to action_success_redirect_path end end else respond_to do |format| format.html do return render layout: false if request.xhr? # Otherwise draw the full page end end end end end |