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 [document.title, document.reference_number, document_date_or_year].reject(&:blank?).join(", ") end def render? opts[:form_url].present? && opts[:form_method].present? end end