Sha256: 96358a2b1e4d77389fee10430fc23c7b02b089b5a50ee6dca9e486175702be90
Contents?: true
Size: 902 Bytes
Versions: 16
Compression:
Stored size: 902 Bytes
Contents
# frozen_string_literal: true module Blacklight module Document # Render a bookmark widget to bookmark / unbookmark a document class BookmarkComponent < Blacklight::Document::ActionComponent # @param [Blacklight::Document] document # @param [Blacklight::Configuration::ToolConfig] action # @param [Boolean] checked # @param [Object] bookmark_path the rails route to use for bookmarks def initialize(document:, action: nil, checked: nil, bookmark_path: nil, **kwargs) @document = document @checked = checked @bookmark_path = bookmark_path super(document: document, action: action, **kwargs) end def bookmarked? return @checked unless @checked.nil? helpers.bookmarked? @document end def bookmark_path @bookmark_path || helpers.bookmark_path(@document) end end end end
Version data entries
16 entries across 16 versions & 2 rubygems