Skip to content

Commit 1fc44bd

Browse files
committed
Fix mustache templates documentation
1 parent 02d6abf commit 1fc44bd

11 files changed

+284
-65
lines changed

templates/downloadpage.mustache

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
}}
1717
{{!
18-
@template local_plugins/frontpage
18+
@template local_amos/downloadpage
1919
20-
Template purpose and description.
20+
Renders the HTML for language packs index at https://download.moodle.org/langpack/x.y/
2121
2222
Classes required for JS:
2323
* none
@@ -26,10 +26,33 @@
2626
* none
2727
2828
Context variables required for this template:
29-
* attributes Array of name / value pairs.
29+
* langpacks
30+
* generatedlabel
31+
* generateddatetime
3032
3133
Example context (json):
32-
{}
34+
{
35+
"langpacks": [
36+
{
37+
"haszip": true,
38+
"langcode": "cs",
39+
"langname": "Czech / Čeština",
40+
"totalstrings": 28848,
41+
"totalenglish": 28848,
42+
"ratio": 100
43+
},
44+
{
45+
"haszip": true,
46+
"langcode": "cs_wp",
47+
"langname": "Czech for Workplace / Čeština pro Workplace",
48+
"parentlanguagecode": "cs",
49+
"parentlanguagename": "Czech / Čeština",
50+
"totalstrings": 43
51+
}
52+
],
53+
"generatedlabel": "2021-03-02 15:03 UTC",
54+
"generateddatetime": "2021-03-02T15:03:19+00:00"
55+
}
3356
}}
3457

3558
<table class="generaltable" width="100%">

templates/filter.mustache

Lines changed: 82 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,81 @@
3535
3636
Context variables required for this template:
3737
* formaction
38+
* lazyformname
39+
* filterdata
40+
* flng
41+
* fcmp
42+
* fver
43+
44+
Example context (json):
45+
{
46+
"formaction": "view.php",
47+
"lazyformname": "amosfilter",
48+
"filterdata": {
49+
"missing": true
50+
},
51+
"flng": {
52+
"options": [
53+
{
54+
"value": "cs",
55+
"text": "Czech / Čeština [cs]",
56+
"selected": true
57+
}
58+
]
59+
},
60+
"fcmp": {
61+
"options": {
62+
"core": [
63+
{
64+
"name": "core",
65+
"label": "core",
66+
"selected": true,
67+
"type": "core",
68+
"typename": "Core",
69+
"since": "2.0+",
70+
"app": "true"
71+
}
72+
],
73+
"standard": [
74+
{
75+
"name": "workshop",
76+
"label": "mod_workshop",
77+
"selected": false,
78+
"type": "standard",
79+
"typename": "Standard",
80+
"since": "2.0+",
81+
"app": "true"
82+
}
83+
],
84+
"contrib": [
85+
{
86+
"name": "theme_moove",
87+
"label": "theme_move",
88+
"selected": false,
89+
"type": "contrib",
90+
"typename": "Additional",
91+
"since": "3.1+",
92+
"app": "false"
93+
}
94+
]
95+
96+
}
97+
},
98+
"fver": {
99+
"options": [
100+
{
101+
"value": 39,
102+
"text": "3.9",
103+
"selected": true
104+
},
105+
{
106+
"value": 310,
107+
"text": "3.10",
108+
"selected": false
109+
}
110+
]
111+
}
112+
}
38113
}}
39114

40115
<div id="amosfilter" data-region="amosfilter" data-level-showadvanced="0" class="mb-3">
@@ -47,14 +122,14 @@
47122

48123
<div class="form-group row" data-region="amosfilter_fcmp">
49124
<div class="col-md-2">
50-
<label for="amosfilter_fcmp" class="mb-0">{{#str}} filtercmp, local_amos {{/str}}</label>
125+
<label class="mb-0">{{#str}} filtercmp, local_amos {{/str}}</label>
51126
<span class="badge badge-pill badge-info" id="amosfilter_fcmp_counter">{{fcmp.numselected}}</span>
52127
<small id="amosfilter_fcmp_desc" class="form-text text-muted">{{#str}} filtercmp_desc, local_amos {{/str}}</small>
53128
</div>
54129

55130
<div class="col-md-10">
56131
<div class="form-control {{^fcmp.numselected}}is-invalid{{/fcmp.numselected}}" style="height: 7rem; overflow-y: scroll" id="amosfilter_fcmp">
57-
<table id="amosfilter_fcmp_items_table" border="0">
132+
<table id="amosfilter_fcmp_items_table">
58133
<tr>
59134
<th colspan="2">{{#str}} typecore, local_amos {{/str}}</th>
60135
</tr>
@@ -83,16 +158,16 @@
83158

84159
<div class="btn-group btn-group-toggle" data-toggle="buttons">
85160
<label class="btn btn-light btn-sm">
86-
<input data-action="selectstandard" type="radio" name="amosfilter_fcmp_actions" autocomplete="off"> {{#str}} componentsstandard, local_amos {{/str}}
161+
<input data-action="selectstandard" type="radio" name="amosfilter_fcmp_actions"> {{#str}} componentsstandard, local_amos {{/str}}
87162
</label>
88163
<label class="btn btn-light btn-sm">
89-
<input data-action="selectapp" type="radio" name="amosfilter_fcmp_actions" autocomplete="off"> {{#str}} componentsapp, local_amos {{/str}}
164+
<input data-action="selectapp" type="radio" name="amosfilter_fcmp_actions"> {{#str}} componentsapp, local_amos {{/str}}
90165
</label>
91166
<label class="btn btn-light btn-sm">
92-
<input data-action="selectall" type="radio" name="amosfilter_fcmp_actions" autocomplete="off"> {{#str}} componentsall, local_amos {{/str}}
167+
<input data-action="selectall" type="radio" name="amosfilter_fcmp_actions"> {{#str}} componentsall, local_amos {{/str}}
93168
</label>
94169
<label class="btn btn-light btn-sm">
95-
<input data-action="selectnone" type="radio" name="amosfilter_fcmp_actions" autocomplete="off"> {{#str}} componentsnone, local_amos {{/str}}
170+
<input data-action="selectnone" type="radio" name="amosfilter_fcmp_actions"> {{#str}} componentsnone, local_amos {{/str}}
96171
</label>
97172
</div>
98173
</div>
@@ -134,7 +209,7 @@
134209
<div class="form-group row">
135210
<div class="col-md-2">
136211
<div data-level="advanced" data-level-control="amosfilter_misc">
137-
<label for="amosfilter_misc">{{#str}} filtermis, local_amos {{/str}}</label>
212+
<label>{{#str}} filtermis, local_amos {{/str}}</label>
138213
<small class="form-text text-muted">{{#str}} filtermis_desc, local_amos {{/str}}</small>
139214
</div>
140215
</div>

templates/filter_fcmp_option.mustache

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@
1818
@template local_amos/filter_fcmp_option
1919
2020
Render filter component selector's component line.
21+
22+
Selectors required for JS:
23+
* amosfilter_fcmp - component selector id
24+
* amosfilter_fcmp_counter - indicator of the number of selected components
25+
* amosfilter_fcmp_search - searchfilterinput field
26+
27+
Context variables required for this template:
28+
* name
29+
* label
30+
* selected
31+
* type
32+
* typename
33+
* since
34+
* app
35+
36+
Example context (json):
37+
{
38+
"name": "core",
39+
"label": "core",
40+
"selected": true,
41+
"type": "core",
42+
"typename": "Core",
43+
"since": "2.0+",
44+
"app": "true"
45+
}
2146
}}
2247
2348
<tr data-region="amosfilter_fcmp_item">

templates/frontpage.mustache

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,9 @@
1515
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
}}
1717
{{!
18-
@template local_plugins/frontpage
18+
@template local_amos/frontpage
1919
20-
Template purpose and description.
21-
22-
Classes required for JS:
23-
* none
24-
25-
Data attributes required for JS:
26-
* none
27-
28-
Context variables required for this template:
29-
* attributes Array of name / value pairs.
20+
Site custom front page.
3021
3122
Example context (json):
3223
{}

templates/stage.mustache

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,29 @@
1919
2020
Render the AMOS Stage page.
2121
22-
Classes required for JS:
23-
* none
24-
25-
Data attributes required for JS:
26-
* none
22+
Context variables required for this template:
23+
* strings
2724
2825
Example context (json):
26+
{
27+
"strings": [
28+
{
29+
"displaysince": "2.0+",
30+
"stringid": "course",
31+
"displaycomponent": "core",
32+
"displaylanguage": "Czech [cs]",
33+
"displayoriginal": "Course",
34+
"hastranslationnew": true,
35+
"hastranslationcurrent": false,
36+
"hastranslationdiff": false,
37+
"unstageurl": "/local/amos/stage.php?unstage=...",
38+
"editurl": "/local/amos/view.php?l=...",
39+
"timelineurl": "/local/amos/timeline.php?component=...",
40+
"statusclass": "new",
41+
"displaytranslationnew": "Kurz"
42+
}
43+
]
44+
}
2945
}}
3046

3147
<div id="amosstagestrings">

templates/timeline.mustache

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,40 @@
1919
2020
Render the string translation timeline.
2121
22-
Classes required for JS:
23-
* none
24-
25-
Data attributes required for JS:
26-
* none
27-
2822
Context variables required for this template:
29-
* attributes Array of name / value pairs.
23+
* changes
3024
3125
Example context (json):
3226
{
33-
"attributes": [
34-
{ "name": "src", "value": "http://moodle.com/wp-content/themes/moodle/images/logo-hat2.png" },
35-
{ "name": "class", "value": "iconsmall" }
27+
"changes": [
28+
{
29+
"translation": {
30+
"hascontent": true,
31+
"displaysince": "2.0+",
32+
"langcode": "cs",
33+
"displaydate": "2006-05-03 16:26 UTC",
34+
"userinfo": "David Mudrak <[email protected]>",
35+
"commitmsg": "David's first translations of 1.6 files.",
36+
"commitsource": "amos",
37+
"hascommithash": false,
38+
"displaytext": "Kurz"
39+
}
40+
},
41+
{
42+
"english": {
43+
"hascontent": true,
44+
"displaysince": "2.0+",
45+
"langcode": "en",
46+
"displaydate": "2006-02-06 09:28 UTC",
47+
"userinfo": "Martin Dougiamas <[email protected]>",
48+
"commitmsg": "New base version of English in Unicode format",
49+
"commitsource": "git",
50+
"hascommithash": true,
51+
"commiturl": "https://github.com/moodle/moodle/commit/49aafb90bd6b08e4ad24b7d305c2e07595315d32",
52+
"commithash": "49aafb90bd6b08e4ad24b7d305c2e07595315d32",
53+
"displaytext": "Course"
54+
}
55+
}
3656
]
3757
}
3858
}}

templates/timeline_change.mustache

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,19 @@
1919
2020
Render info about a particular string change.
2121
22-
Classes required for JS:
23-
* none
24-
25-
Data attributes required for JS:
26-
* none
27-
28-
Context variables required for this template:
29-
* attributes Array of name / value pairs.
30-
3122
Example context (json):
3223
{
33-
"attributes": [
34-
{ "name": "src", "value": "http://moodle.com/wp-content/themes/moodle/images/logo-hat2.png" },
35-
{ "name": "class", "value": "iconsmall" }
36-
]
24+
"hascontent": true,
25+
"displaysince": "3.9+",
26+
"langcode": "cs",
27+
"displaydate": "2006-05-03 16:26 UTC",
28+
"userinfo": "David Mudrak <[email protected]>",
29+
"commitmsg": "David's first translations of 1.6 files.",
30+
"commitsource": "git",
31+
"hascommithash": true,
32+
"commiturl": "https://github.com/mudrd8mz/moodle-lang/commit/f51d8940de39cc21cfa22d0fba0ef1b724d214b6",
33+
"commithash": "f51d8940de39cc21cfa22d0fba0ef1b724d214b6",
34+
"displaytext": "Kurz"
3735
}
3836
}}
3937

templates/translator.mustache

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
@template local_amos/translator
1919
2020
Render the AMOS Translator widget and initialize the module.
21+
22+
See local_amos/translator_root for more documentation.
23+
24+
Example context (json):
25+
{}
2126
}}
2227

2328
<div id="amostranslator">

templates/translator_paginator.mustache

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,27 @@
1717
{{!
1818
@template local_amos/translator_paginator
1919
20-
Template purpose and description.
21-
22-
Classes required for JS:
23-
* none
24-
25-
Data attributes required for JS:
26-
* none
20+
Renders the paginator widget.
2721
2822
Context variables required for this template:
29-
* attributes Array of name / value pairs.
23+
* hasmultiplepages
24+
* navigation
3025
3126
Example context (json):
3227
{
33-
"attributes": [
34-
{ "name": "src", "value": "http://moodle.com/wp-content/themes/moodle/images/logo-hat2.png" },
35-
{ "name": "class", "value": "iconsmall" }
28+
"hasmultiplepages": true,
29+
"navigation": [
30+
{
31+
"iscurrent": true,
32+
"islink": false,
33+
"label": 1
34+
},
35+
{
36+
"iscurrent": false,
37+
"islink": true,
38+
"value": 2,
39+
"label": 2
40+
}
3641
]
3742
}
3843
}}

0 commit comments

Comments
 (0)