Module: BlacklightIiifSearch::AnnotationBehavior

Included in:
IiifSearchAnnotation
Defined in:
app/models/concerns/blacklight_iiif_search/annotation_behavior.rb

Instance Method Summary collapse

Instance Method Details

#annotation_idString

Create a URL for the annotation

Returns:

  • (String)


9
10
11
# File 'app/models/concerns/blacklight_iiif_search/annotation_behavior.rb', line 9

def annotation_id
  "#{controller.solr_document_url(parent_document[:id])}/canvas/#{document[:id]}/annotation/#{hl_index}"
end

#canvas_uri_for_annotationString

Create a URL for the canvas that the annotation refers to

Returns:

  • (String)


16
17
18
# File 'app/models/concerns/blacklight_iiif_search/annotation_behavior.rb', line 16

def canvas_uri_for_annotation
  "#{controller.solr_document_url(parent_document[:id])}/canvas/#{document[:id]}" + coordinates
end

#coordinatesString

return a string like “#xywh=100,100,250,20” corresponding to coordinates of query term on image local implementation expected, value returned below is just a placeholder

Returns:

  • (String)


25
26
27
28
# File 'app/models/concerns/blacklight_iiif_search/annotation_behavior.rb', line 25

def coordinates
  return '' unless query
  '#xywh=0,0,0,0'
end