-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable configuration of the index tools partials
- Loading branch information
Showing
6 changed files
with
59 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Blacklight | ||
module Catalog::IndexTools | ||
extend ActiveSupport::Concern | ||
included do | ||
helper_method :index_tool_partials | ||
end | ||
|
||
def index_tool_partials | ||
self.class.index_tool_partials | ||
end | ||
|
||
module ClassMethods | ||
def index_tool_partials | ||
@index_tool_partials ||= [] | ||
end | ||
|
||
## | ||
# @param partial [String] the name of the document partial | ||
# @param opts [Hash] | ||
# @option opts [Symbol,Proc] :if render this action if the method identified by the symbol or the proc evaluates to true. | ||
# The proc will receive the action configuration and the document or documents for the action. | ||
# @option opts [Symbol,Proc] :unless render this action unless the method identified by the symbol or the proc evaluates to true | ||
# The proc will receive the action configuration and the document or documents for the action. | ||
def add_index_tools_partial partial, opts = {} | ||
config = Blacklight::Configuration::ToolConfig.new({partial: partial}.merge(opts)) | ||
|
||
if block_given? | ||
yield config | ||
end | ||
index_tool_partials << config | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters