Skip to content

Commit

Permalink
gh-23 Added docid to search results and link from search results to t…
Browse files Browse the repository at this point in the history
…he annotation on the annotator tab.
  • Loading branch information
geoffroy-noel-ddh committed Sep 15, 2023
1 parent 32ca318 commit 648f017
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
14 changes: 13 additions & 1 deletion app/assets/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,22 @@ createApp({
this.results = this.itemsjs.search()
},
getThumbUrlFromItem(item) {
let ret = null;
let ret = null
let crop = item.box.substring(11)
ret = `${item.img}/${crop}/,48/0/default.jpg`

return ret
},
getDocIdFromItem(item) {
let ret = item.doc.replace(/^.*id=/, '')
return ret
},
getAnnotatorLinkFromItem(item) {
// TODO: remove hard-coded assumptions.
// the transforms (obj, img) should be more dynamic than that.
let ret = ''
let annotatorImageId = item.img.replace('_tiled.tif', `.jpg`).replace(/^.*\//, '')
ret = `/annotator.html?obj=http://sicily.classics.ox.ac.uk/inscription/${this.getDocIdFromItem(item)}&img=${annotatorImageId}&ann=${item.id}`
return ret
}
}
Expand Down
9 changes: 8 additions & 1 deletion app/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ <h2 class="title is-3">Annotations ({{ pagination.total }})</h2>
<div class="media">
<div class="media-left">
<figure class="image">
<img :src="getThumbUrlFromItem(item)" alt="Placeholder image">
<a :href="getAnnotatorLinkFromItem(item)">
<img :src="getThumbUrlFromItem(item)" alt="Placeholder image">
</a>
</figure>
</div>
<div class="media-content">
Expand All @@ -92,7 +94,12 @@ <h2 class="title is-3">Annotations ({{ pagination.total }})</h2>
</div>
</div>

<div class="content">
{{ getDocIdFromItem(item) }}
</div>

</div>

</span>
</div>
</div>
Expand Down

0 comments on commit 648f017

Please sign in to comment.