You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
907 B
36 lines
907 B
class AnnotationMarksModalFormComponent < BaseComponent |
|
attr_reader :document, :annotation, :opts |
|
|
|
def initialize(current_user:, document:, annotation:, opts:) |
|
@document = document |
|
@annotation = annotation |
|
@opts = opts |
|
end |
|
|
|
def document_date_or_year |
|
return document.year if document.docdate.blank? |
|
|
|
document.docdate.strftime("%B %d, %Y") |
|
end |
|
|
|
def document_title |
|
title = document.short_title || document.title |
|
[title, document.reference_number, document_date_or_year].reject(&:blank?).join(", ") |
|
end |
|
|
|
def citing_documents_reference_numbers |
|
return if annotation.documents.blank? |
|
|
|
annotation.documents.map(&:reference_number).join(" citing ") |
|
end |
|
|
|
def citing_document_ids |
|
return if annotation.documents.blank? |
|
|
|
annotation.documents.map(&:id).join(",") |
|
end |
|
|
|
def render? |
|
opts[:form_url].present? && opts[:form_method].present? |
|
end |
|
end |