|
|
|
|
@ -2,6 +2,8 @@ class DoctrineIndexComponent < BaseComponent
|
|
|
|
|
with_collection_parameter :doctrine |
|
|
|
|
attr_reader :doctrine, :opts |
|
|
|
|
|
|
|
|
|
include AnnotationSearch |
|
|
|
|
|
|
|
|
|
def initialize(doctrine:, current_user:, opts: {}) |
|
|
|
|
@doctrine = doctrine |
|
|
|
|
@opts = opts |
|
|
|
|
@ -10,10 +12,10 @@ class DoctrineIndexComponent < BaseComponent
|
|
|
|
|
delegate :id, to: :doctrine |
|
|
|
|
delegate :subject_ids, to: :doctrine |
|
|
|
|
delegate :content, to: :doctrine |
|
|
|
|
delegate :annotations, to: :doctrine |
|
|
|
|
delegate :subjects, to: :doctrine |
|
|
|
|
delegate :headnote, to: :doctrine |
|
|
|
|
delegate :doctrine_jurisprudences, to: :doctrine |
|
|
|
|
delegate :jurisprudences, to: :doctrine |
|
|
|
|
|
|
|
|
|
def annotation_form_url |
|
|
|
|
doctrine_annotations_path(doctrine_id: id) |
|
|
|
|
@ -26,7 +28,7 @@ class DoctrineIndexComponent < BaseComponent
|
|
|
|
|
def jurisprudence |
|
|
|
|
return nil if doctrine_jurisprudences.blank? |
|
|
|
|
|
|
|
|
|
doctrine_jurisprudences.first.jurisprudence |
|
|
|
|
jurisprudences.first |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def document_title(annotation) |
|
|
|
|
@ -53,6 +55,11 @@ class DoctrineIndexComponent < BaseComponent
|
|
|
|
|
annotation.phil_rep.gsub(/(PhilRep|Phil)\.?,?/i, "Phil") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def annotations |
|
|
|
|
search = annotation_search(doctrine_id: id) |
|
|
|
|
search.results |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def render? |
|
|
|
|
doctrine.present? && doctrine.persisted? |
|
|
|
|
end |
|
|
|
|
|