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)


7
8
9
# File 'app/models/concerns/blacklight_iiif_search/annotation_behavior.rb', line 7

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)


14
15
16
# File 'app/models/concerns/blacklight_iiif_search/annotation_behavior.rb', line 14

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)


23
24
25
26
# File 'app/models/concerns/blacklight_iiif_search/annotation_behavior.rb', line 23

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