Sha256: a4e25b9eabd1f2c739407e222dfea96f08de41df877a56080c00b31656889241
Contents?: true
Size: 1.24 KB
Versions: 16
Compression:
Stored size: 1.24 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, link_classes: 'nav-link') @document = document @action = action @options = options @url_opts = url_opts @id = id || @action.fetch(:id, "#{@action.name}Link") @link_classes = link_classes 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 def key @action.key end end end end
Version data entries
16 entries across 16 versions & 1 rubygems