Skip to content

Commit

Permalink
Merge pull request #730 from euphorie/scrum-2142-certificate-logo
Browse files Browse the repository at this point in the history
Show organisation logo on training certificate
  • Loading branch information
cillianderoiste authored May 15, 2024
2 parents bcb6461 + de649b1 commit b7219db
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Changelog
- Add certificates overview
Ref: scrum-2142

- Show organisation logo on training certificate
Ref: scrum-2142



16.1.2 (2024-03-20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
i18n:name="date"
>${python:toLocalizedTime(certificate.time)}</time>.
</p>
<p class="certificate-organisation"
tal:condition="view/organisation_logo"
>
<img class="certificate-organisation-logo"
src="${view/organisation_logo}"
/>
</p>
<table class="certificate-colofon">
<tbody>
<tr>
Expand Down
12 changes: 12 additions & 0 deletions src/euphorie/client/browser/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,18 @@ class SlideQuestionSuccess(SlideQuestionIntro):
def post(self):
pass

@property
@view_memoize
def organisation_logo(self):
organisation = self.context.session.account.organisation
if not organisation or not organisation.image_filename:
return None
country_url = self.webhelpers.country_obj.absolute_url()
return (
f"{country_url}/@@organisation-logo/{organisation.organisation_id}"
f"?q={organisation.image_filename}"
)

def __call__(self):
training = self.get_or_create_training()
if training.status not in ("correct", "success"):
Expand Down

0 comments on commit b7219db

Please sign in to comment.