@@ -36,7 +36,7 @@ class DocumentComponent < Blacklight::Component
3636 renders_one :title , ( lambda do |component : nil , **kwargs |
3737 component ||= view_config . document_title_component
3838
39- component &.new ( counter : @counter , presenter : @presenter , as : @title_component , actions : ! @show , link_to_document : !@show , document_component : self , **kwargs )
39+ component &.new ( counter : @counter , presenter : @presenter , as : @title_component , link_to_document : !@show , document_component : self , **kwargs )
4040 end )
4141
4242 renders_one :embed , ( lambda do |static_content = nil , component : nil , **kwargs |
@@ -57,6 +57,8 @@ class DocumentComponent < Blacklight::Component
5757 # Additional metadata sections
5858 renders_many :metadata_sections
5959
60+ renders_one :actions
61+
6062 renders_one :thumbnail , ( lambda do |image_options_or_static_content = { } , component : nil , **kwargs |
6163 next image_options_or_static_content if image_options_or_static_content . is_a? String
6264
@@ -69,9 +71,6 @@ class DocumentComponent < Blacklight::Component
6971 # the ecosystem fully adopts view components.
7072 renders_many :partials
7173
72- # Backwards compatibility
73- renders_one :actions
74-
7574 # rubocop:disable Metrics/ParameterLists
7675 # @param document [Blacklight::DocumentPresenter]
7776 # @param partials [Array, nil] view partial names that should be used to provide content for the `partials` slot
@@ -127,12 +126,31 @@ def before_render
127126 end
128127 end
129128
129+ # Content for the document actions area
130+ def actions
131+ return [ ] if hide_actions?
132+
133+ if block_given?
134+ return super
135+ end
136+
137+ if actions?
138+ return Array ( super )
139+ end
140+
141+ helpers . render_index_doc_actions ( presenter . document , wrapping_class : 'index-document-functions col-sm-3 col-lg-2 mb-4 mb-sm-0' )
142+ end
143+
130144 private
131145
132146 delegate :view_config , to : :@presenter
133147
134148 attr_reader :document_counter , :counter , :document , :presenter , :view_partials
135149
150+ def hide_actions?
151+ show?
152+ end
153+
136154 def show?
137155 @show
138156 end
0 commit comments