@@ -36,7 +36,7 @@ class DocumentComponent < Blacklight::Component
3636 renders_one :title , ( lambda do |component : nil , **kwargs |
3737 component ||= view_config . title_component || Blacklight ::DocumentTitleComponent
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 |
@@ -60,6 +60,8 @@ class DocumentComponent < Blacklight::Component
6060 # Additional metadata sections
6161 renders_many :metadata_sections
6262
63+ renders_one :actions
64+
6365 renders_one :thumbnail , ( lambda do |image_options_or_static_content = { } , component : nil , **kwargs |
6466 next image_options_or_static_content if image_options_or_static_content . is_a? String
6567
@@ -72,9 +74,6 @@ class DocumentComponent < Blacklight::Component
7274 # the ecosystem fully adopts view components.
7375 renders_many :partials
7476
75- # Backwards compatibility
76- renders_one :actions
77-
7877 # rubocop:disable Metrics/ParameterLists
7978 # @param document [Blacklight::DocumentPresenter]
8079 # @param partials [Array, nil] view partial names that should be used to provide content for the `partials` slot
@@ -130,12 +129,29 @@ def before_render
130129 end
131130 end
132131
132+ # Content for the document actions area
133+ def actions
134+ return [ ] if hide_actions?
135+
136+ if block_given?
137+ @has_actions_slot = true
138+ return super
139+ end
140+
141+ ( @has_actions_slot && get_slot ( :actions ) ) ||
142+ [ helpers . render_index_doc_actions ( presenter . document , wrapping_class : 'index-document-functions col-sm-3 col-lg-2 mb-4 mb-sm-0' ) ]
143+ end
144+
133145 private
134146
135147 delegate :view_config , to : :@presenter
136148
137149 attr_reader :document_counter , :counter , :document , :presenter , :view_partials
138150
151+ def hide_actions?
152+ show?
153+ end
154+
139155 def show?
140156 @show
141157 end
0 commit comments