Sha256: b4f0c9fafd7fc1d353e4470a5a6751623d160efcd90d2729019645d7d00fe361
Contents?: true
Size: 1.14 KB
Versions: 10
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module Blacklight module Document # Render a bookmark widget to bookmark / unbookmark a document class ActionComponent < ::ViewComponent::Base with_collection_parameter :action # @param [Blacklight::Document] document def initialize(document:, action:, options: {}, url_opts: {}, id: nil) @document = document @action = action @options = options @url_opts = url_opts @id = id || @action.fetch(:id, "#{@action.name}Link") end def using_default_document_action? return true if @action.component return false unless @action.partial == 'document_action' @view_context.partial_from_blacklight?(@action.partial) end def label Deprecation.silence(Blacklight::ComponentHelperBehavior) do @view_context.document_action_label(@action.name, @action) end end def url Deprecation.silence(Blacklight::ComponentHelperBehavior) do @view_context.document_action_path(@action, @url_opts.merge(({ id: @document } if @document) || {})) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems