-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #729 from euphorie/scrum-2142-certificates-overview
Add certificates overview
- Loading branch information
Showing
7 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from plone import api | ||
from plone.memoize.view import memoize | ||
from Products.Five import BrowserView | ||
|
||
|
||
class View(BrowserView): | ||
"""Certificates Overview Page""" | ||
|
||
@property | ||
@memoize | ||
def trainings_portlet(self): | ||
return api.content.get_view( | ||
name="portlet-my-trainings", context=self.context, request=self.request | ||
) | ||
|
||
@property | ||
@memoize | ||
def my_certificates(self): | ||
certificates = {} | ||
for training in self.trainings_portlet.my_certificates: | ||
year = training.time.year | ||
link = f"{training.session.absolute_url()}/@@training-certificate-view" | ||
content = self.trainings_portlet.get_certificate(training.session) | ||
certificates.setdefault(year, []).append({"link": link, "content": content}) | ||
return certificates.items() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
xmlns:meta="http://xml.zope.org/namespaces/meta" | ||
xmlns:metal="http://xml.zope.org/namespaces/metal" | ||
xmlns:tal="http://xml.zope.org/namespaces/tal" | ||
meta:interpolation="true" | ||
metal:use-macro="context/@@shell/macros/shell" | ||
i18n:domain="euphorie" | ||
> | ||
|
||
<!-- The equivalent template in the Jekyll prototype is /certificates --> | ||
|
||
<body> | ||
<metal:slot fill-slot="content"> | ||
<div id="content-pane"> | ||
<metal:homescreen_navigation use-macro="here/view/macros/homescreen_navigation"> | ||
<metal:slot fill-slot="view_options" /> | ||
<metal:slot fill-slot="quick_functions" /> | ||
</metal:homescreen_navigation> | ||
<div id="application-content"> | ||
<div class="portlet"> | ||
<div class="content"> | ||
<tal:year tal:repeat="item view/my_certificates"> | ||
<tal:year tal:define=" | ||
year python:item[0]; | ||
sessions python:item[1]; | ||
"> | ||
<h2 class="separation-title"> | ||
${year} | ||
</h2> | ||
<div class="certificate-overview col-3"> | ||
<tal:session tal:repeat="info sessions"> | ||
<figure class="certificate-preview"> | ||
<a class="certificate pat-auto-scale pat-inject" | ||
href="${info/link}" | ||
data-pat-inject="source: #content; target: #content; history: record" | ||
tal:condition="nocall:info/content" | ||
> | ||
<tal:certificate replace="structure info/content" /> | ||
</a> | ||
</figure> | ||
</tal:session> | ||
|
||
</div> | ||
</tal:year> | ||
</tal:year> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</metal:slot> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters