Skip to content

Commit

Permalink
Change datatable details, and add accession name retrieval to Image.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
bm743 committed Feb 24, 2025
1 parent d554d71 commit 487860c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
19 changes: 19 additions & 0 deletions lib/SGN/Controller/AJAX/Search/Image.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ sub image_search :Path('/ajax/search/images') Args(0) {
my $image_page = "/image/view/$image_id";
my $colorbox = qq|<a href="$image_img" title="<a href=$image_page>Go to image page ($image_name)</a>" class="image_search_group" rel="gallery-figures"><img src="$small_image" width="40" height="30" border="0" alt="$image_description" /></a>|;

my $plot_name = $_->{stock_uniquename};
my $accession_name;
if ($plot_name) {
my $plot_stock = $schema->resultset('Stock::Stock')->find({uniquename => $plot_name});
if ($plot_stock) {
my $accession_stock = $plot_stock->search_related('stock_relationship_subjects', {
'type.name' => 'plot_of',
}, {
join => 'type',
})-> single;
if ($accession_stock) {
my $accession_id = $accession_stock->object->stock_id;
my $accession_uniquename = $accession_stock->object->uniquename;
$accession_name = "<a href='/stock/$accession_id/view'>$accession_uniquename</a>";
}
}
}

my @line;
if ($params->{html_select_box}) {
push @line, "<input type='checkbox' name='".$params->{html_select_box}."' value='".$_->{image_id}."'>";
Expand All @@ -121,6 +139,7 @@ sub image_search :Path('/ajax/search/images') Args(0) {
$_->{image_description},
"<a href='/solpeople/personal-info.pl?sp_person_id=".$_->{image_sp_person_id}."' >".$_->{image_username}."</a>",
$associations,
$accession_name,
$observations,
(join ', ', @tags)
);
Expand Down
8 changes: 5 additions & 3 deletions mason/image/plot_images.mas
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ $stockref => undef
<thead>
<tr>
<th>Image</th>
<th>Filename</th>
<th>File Name/Details</th>
<th>Description</th>
<th>Submitter</th>
<th>Associations</th>
<th>Accession Name</th>
</tr>
</thead>
</table>
Expand Down Expand Up @@ -106,7 +107,7 @@ function _load_stock_image_results() {
'dataSrc': function(json) {
json.data.forEach(function(row) {
var imgElement = jQuery(row[0]).find('img');
imgElement.attr('width', '160').attr('height', '140');
imgElement.attr('width', '140').attr('height', '120');
var anchorElement = jQuery(row[0]);
anchorElement.html(imgElement.prop('outerHTML'));
row[0] = anchorElement.prop('outerHTML');
Expand All @@ -117,10 +118,11 @@ function _load_stock_image_results() {
'columns': [
{ 'title': 'Image',
'data': 0, },
{ 'title': 'Filename', 'data': 1 },
{ 'title': 'File Name/Details', 'data': 1 },
{ 'title': 'Description', 'data': 2 },
{ 'title': 'Submitter', 'data': 3 },
{ 'title': 'Associations', 'data': 4 },
{ 'title': 'Accession Name', 'data': 5 },
],
columnDefs: [
{ "targets": [1,3,4], "type": 'html' },
Expand Down

0 comments on commit 487860c

Please sign in to comment.