Add example JSON context to templates

This commit is contained in:
Mark Nelson 2018-06-07 19:29:34 +08:00
parent a42bc9ebe1
commit 0e5ef79ab9
2 changed files with 88 additions and 0 deletions

View file

@ -24,6 +24,48 @@
Data attibutes required for JS: Data attibutes required for JS:
* All data attributes are required * All data attributes are required
Context variables required for this template:
* certificate
* cmid
* showgroups
* groups
* canmanage
* hasissues
* issues
* currenttimestamp
Example context (json):
{
"certificate": {
"id": "1",
"course": "2",
"name": "A rad certificate name!",
"intro": "A certificate"
},
"cmid": "25",
"showgroups": "true",
"groups": [
{
"id": "2",
"selected": "false",
"name": "Group A"
}
],
"canmanage": "true",
"hasissues": "true",
"issues": [
{
"id": "2",
"issueid": "3",
"displayname": "Michaelangelo (Mickey)",
"fileurl": "http://yoursite.com/mod/customcert/mobile/pluginfile.php?id=4",
"code": "Xyt78axR",
"timecreated": "1528370177"
}
],
"currenttimestamp": "1528370177"
}
}} }}
{{=<% %>=}} {{=<% %>=}}
<div> <div>

View file

@ -24,6 +24,52 @@
Data attibutes required for JS: Data attibutes required for JS:
* All data attributes are required * All data attributes are required
Context variables required for this template:
* certificate
* cmid
* groupselected
* showgroups
* groups
* hasissues
* issues
* candownload
* fileurl
* showreport
* numissuesinreport
* currenttimestamp
Example context (json):
{
"certificate": {
"id": "1",
"course": "2",
"name": "A rad certificate name!",
"intro": "A certificate",
"requiredtime": "60"
},
"cmid": "25",
"groupselected": "5",
"showgroups": "true",
"groups": [
{
"id": "2",
"selected": "false",
"name": "Group A"
}
],
"hasissues": "true",
"issues": [
{
"timecreated": "1528370177"
}
],
"candownload": "true",
"fileurl": "http://yoursite.com/mod/customcert/mobile/pluginfile.php?id=4",
"showreport": "true",
"numissuesinreport": "5",
"currenttimestamp": "1528370177"
}
}} }}
{{=<% %>=}} {{=<% %>=}}
<div> <div>