I’m trying to change the design of the certificate stylesheet in openx. I am the theme of my site and put _overrides.scss in the folder. Nothing changes after creating the theme
Currently, there are 2 ways of customizing certificates in the platform (in the Ironwood release):
Use the Django Admin and set the certificate and assets (recommended).
Modify the platform certificate template and styles from your custom theme.
I’ll go into detail about how to set up a custom certificate using Django Admin panel of your instance. Follow these instructions:
Make sure that certificates and the HTML views are enabled on your instance. You can follow the instructions here.
Add a new Certificate Template with your custom template from https://<your-instance-url>/admin/certificates/certificatetemplate/. You can see a simple certificate example below:
<%namespace name='static' file='/static_content.html'/>
<!DOCTYPE html>
<html>
<head>
<title>${document_title}</title>
<%static:css group='style-certificates'/>
<link rel="stylesheet" href="${static.certificate_asset_url('certificate-styles')}">
</head>
<body class="some-class">
<div class="cert-header">
<img src="${static.certificate_asset_url('header')}" class="certificate-header"/>
</div>
<p class="some-other-class">
<span>
This is to certify that
</span>
<strong>
${accomplishment_copy_name | h}
</strong>
<span>
completed the course
</span>
<span >
${accomplishment_copy_course_name}.
</span>
</p>
</body>
</html>
If you want to include any static assets, make sure to add them to the Certificate Assets page (https://<your-instance-url>/admin/certificates/certificatetemplateasset/) with a proper slug.
You’ll need the slug to reference the assets in the template. Like shown on the example below:
# Make sure that this is present on your template:
<%namespace name='static' file='/static_content.html'/>
# Reference a stylesheet
<link rel="stylesheet" href="${static.certificate_asset_url('certificate-styles')}">
# Reference an image
<img src="${static.certificate_asset_url('header')}"/>
Enable certificates for each course on https://<your-instance-url>/admin/certificates/certificategenerationcoursesetting/
The variables available in the certificate are not well documented, but you can find them by digging into the codebase starting here.
Hello @giovannicimolin@anjali Thank you for the guides. They were really helpful, although I’ve got one more question regarding the cerificates. I followed the 2nd way @giovannicimolin described using admin panel in order to create a custom certificate
And i’ve got an empty cert with my html on preview certificate, but i also want to have the print options etc that have the original, how can i do that.
@nadiastef, the print options that are displayed in the default certificate template come from here. You will be able to get the same options by using the relevant markup from that file in your custom certificate template.
I was using 2nd way of certificate customization by mirroring lms/static/certificates/sass/main-ltr.scss file structure ( I was on Ironwood version ). However, it seems like the CSS output file was not generated.
When I’ve modified the *.scss, I can see watchthemes detected file changed on main-ltr.scss, but looking closely on the output, I cannot see main-ltr.css as it should be. This doesn’t happen with other *.scss files in lms/static/sass folder.