Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task #214827 chore: On certificate page links insidethe download popover is not working #161

Open
wants to merge 4 commits into
base: dev-joomla4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@
<a id="download-popover" data-container="body" data-placement="bottom" tabindex="0" class="tj-certificate-btn" role="button" data-toggle="popover" data-trigger="focus" title="<?php echo Text::_('COM_TJCERTIFICATE_CERTIFICATE_DOWNLOAD');?>"><i class="fa fa-share-square-o mr-10" aria-hidden="true"></i>
<?php echo Text::_('COM_TJCERTIFICATE_CERTIFICATE_DOWNLOAD');?>
</a>
<div id="download-popover-content" class="hide">
<a class="d-block mb-15" id="downloadImage" href="<?php echo $this->imagePath;?>" download ><i class="fa fa-download mr-5" aria-hidden="true"></i>
<div id="download-popover-content" class="hide downloadboxcert">
<a class="d-block mb-15" id="downloadImage" href="#<?php echo $this->imagePath;?>" ><i class="fa fa-download mr-5" aria-hidden="true"></i>
<?php echo Text::_('COM_TJCERTIFICATE_CERTIFICATE_DOWNLOAD_AS_IMAGE'); ?>
</a>
<?php
Expand All @@ -135,9 +135,12 @@
}
}
?>
<span class="btn-print">
<input type="button" class="btn-print" onclick="certificateImage.printCertificate('certificateContent')" value="<?php echo Text::_('COM_TJCERTIFICATE_CERTIFICATE_PRINT');?>" />
</span>

<a id ='printcertificate'type="button"class="d-block mb-15" >
<i class="fa fa-print mr-5" aria-hidden="true"></i>
<?php echo Text::_('COM_TJCERTIFICATE_CERTIFICATE_PRINT'); ?>
</a>

</div>

<?php
Expand Down Expand Up @@ -237,4 +240,27 @@
}
?>

// Get the certificate Download options working correctly.

$(document).on("click", "#printcertificate", function() {
var printContent = document.getElementById('certificateContent').innerHTML;
var originalContent = document.body.innerHTML;
document.body.innerHTML = printContent;
window.print();
document.body.innerHTML = originalContent;

certificateImage.enableDownloadShareBtns();
window.location.reload(true);

});

jQuery(document).on("click","#downloadImage",function (){
var a = document.createElement('a');
a.href = "<?php echo $this->imagePath;?>";
a.download = "output.png";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
})

</script>