app/helpers/blacklight/component_helper_behavior.rb in blacklight-6.11.0 vs app/helpers/blacklight/component_helper_behavior.rb in blacklight-6.11.1
- old
+ new
@@ -52,11 +52,11 @@
content_tag("div", rendered, class: wrapping_class) unless rendered.blank?
end
def render_filtered_partials(partials, options={}, &block)
content = []
- partials.select { |_, config| blacklight_configuration_context.evaluate_if_unless_configuration config, options }.each do |key, config|
+ filter_partials(partials, options).each do |key, config|
config.key ||= key
rendered = render(partial: config.partial || key.to_s, locals: { document_action_config: config }.merge(options))
if block_given?
yield config, rendered
else
@@ -75,8 +75,18 @@
# @param [SolrDocument] document
# @param [Hash] options
# @return [String]
def render_show_doc_actions(document=@document, options={}, &block)
render_filtered_partials(blacklight_config.show.document_actions, { document: document }.merge(options), &block)
+ end
+
+ def show_doc_actions?(document = @document, options = {})
+ filter_partials(blacklight_config.show.document_actions, { document: document }.merge(options)).any?
+ end
+
+ private
+
+ def filter_partials(partials, options)
+ partials.select { |_, config| blacklight_configuration_context.evaluate_if_unless_configuration config, options }
end
end
end