Class: Blacklight::Document::BookmarkComponent
- Inherits:
-
Component
- Object
- ViewComponent::Base
- Component
- Blacklight::Document::BookmarkComponent
- Defined in:
- app/components/blacklight/document/bookmark_component.rb
Overview
Render a bookmark widget to bookmark / unbookmark a document
Instance Method Summary collapse
- #bookmark_path ⇒ Object
- #bookmarked? ⇒ Boolean
-
#initialize(document:, checked: nil, bookmark_path: nil) ⇒ BookmarkComponent
constructor
A new instance of BookmarkComponent.
Methods inherited from Component
reset_compiler!, sidecar_files, upstream_sidecar_files
Constructor Details
#initialize(document:, checked: nil, bookmark_path: nil) ⇒ BookmarkComponent
Returns a new instance of BookmarkComponent.
10 11 12 13 14 |
# File 'app/components/blacklight/document/bookmark_component.rb', line 10 def initialize(document:, checked: nil, bookmark_path: nil) @document = document @checked = checked @bookmark_path = bookmark_path end |
Instance Method Details
#bookmark_path ⇒ Object
22 23 24 |
# File 'app/components/blacklight/document/bookmark_component.rb', line 22 def bookmark_path @bookmark_path || helpers.bookmark_path(@document) end |
#bookmarked? ⇒ Boolean
16 17 18 19 20 |
# File 'app/components/blacklight/document/bookmark_component.rb', line 16 def bookmarked? return @checked unless @checked.nil? helpers.bookmarked? @document end |