Skip to content

Commit

Permalink
Merge pull request #5266 from solgenomics/display_accession_image
Browse files Browse the repository at this point in the history
Display accession image
  • Loading branch information
lukasmueller authored Jan 9, 2025
2 parents 954f395 + 29d590c commit 2e409b6
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions mason/stock/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,46 @@ function jqueryStuff() {


</div>
<%perl>
if ($type_name eq 'accession') {
</%perl>
<div class="col-sm-6">
<div style="position: relative;">
<button class="btn btn-default btn-small" id="toggle_qr_code" style="position: absolute; right: 10px; top: 10px; z-index: 10;">Show QR Code</button>
</div>
</div>

<div id ="qr_code_display" style="display: none; text-align: center; margin-top: 40px;">
<div style="text-align: center;">
<& /util/barcode.mas, identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode" &>
</div>
</div>

<div class="col-sm-6">
<br /><br />
<div style="display: flex; justify-content: center; align-items; height: 100%; margin-top: 20px;">
<%perl>
use SGN::Image;
my $image_id = $stockref->{image_ids}->[0]->[0];
my $image = SGN::Image->new($schema->storage->dbh, $image_id, $c);
my $image_url = $image->get_image_url('small');
</%perl>

<img src="<% $image_url %>" alt="No accession image to display" class="img-responsive" style="max-width: 100%; height: auto;" />
</div>
<br /><br />
</div>
<%perl>
} else {
</%perl>
<div class="col-sm-6">
<br /><br />
<& /util/barcode.mas, identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode" &>
<br /><br />
</div>
<%perl>
}
</%perl>
</div>

<div class="row">
Expand Down Expand Up @@ -450,6 +485,18 @@ function jqueryStuff() {
}
});

jQuery('#toggle_qr_code').click(function() {
var qrCodeDisplay = jQuery('#qr_code_display');
var buttonText = jQuery(this).text();

qrCodeDisplay.toggle();
if (qrCodeDisplay.is(':visible')) {
jQuery(this).text('Hide QR Code');
} else {
jQuery(this).text('Show QR Code');
}
});


});

Expand Down

0 comments on commit 2e409b6

Please sign in to comment.