Skip to content

Commit a12a0a9

Browse files
authored
Merge pull request #77 from layer5io/exam
Exam
2 parents 6be8b4c + 53908d1 commit a12a0a9

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

layouts/partials/common-curricula-properties.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99

10-
"title": {{ $page.Title | jsonify }},
10+
"title": {{ partial "title.html" $page | jsonify }},
1111
"slug": {{ or $page.Slug $page.File.ContentBaseName | jsonify }},
1212
"id": {{ $id | jsonify }},
1313
"level": {{ $page.Params.level | jsonify }},

layouts/partials/index-of-page.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- $current := . -}}
2+
3+
{{- $pages := where $current.Parent.Pages "Type" $current.Type -}}
4+
5+
{{- $index := 1 -}}
6+
{{- range $i, $p := $pages -}}
7+
{{- if eq $p.RelPermalink $current.RelPermalink -}}
8+
{{- $index = $i -}}
9+
{{- end -}}
10+
{{- end -}}
11+
12+
{{- return $index -}}

layouts/partials/learning-path.json.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@
2727
"categories": {{ .Params.Categories | jsonify }},
2828
"tags": {{ .Params.Tags | jsonify }},
2929
"total_courses": {{ len (where .Pages "Type" "course") }},
30+
"total_tests": {{ len (where .Pages "Type" "test") }},
31+
"total_modules": {{ len (where .Pages "Type" "module") }},
32+
"total_pages": {{ len (where .Pages "Type" "page") }},
3033

31-
"courses": [
34+
"children": [
3235
{{- range $j, $c := .Pages }}
3336
{{- if $j }},{{ end }}
3437
{{ partial "course.json.html" (dict "page" $c "uuid" $uuid) }}

layouts/partials/test/title.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
{{- $title := "" -}}
22
{{- $page := . -}}
3-
{{- $weight := or $page.Params.weight $page.Params.Order "" -}}
3+
{{- $index := add 1 (partial "index-of-page.html" $page) -}}
44
{{- $parentType := "" -}}
5+
{{- $isFinal := partial "test/is-final.html" $page -}}
56

67
{{- with $page.Parent -}}
78
{{- $parentType = .Params.Type -}}
89
{{- end -}}
910

10-
{{- if partial "test/is-final.html" $page -}}
11-
{{- $title = printf "%sFinal " $title -}}
11+
{{- if $isFinal -}}
12+
{{- $title = printf "%sFinal" $title -}}
1213
{{- end -}}
1314

1415
{{- if $page.Params.is_optional -}}
15-
{{- $title = printf "%sOptional " $title -}}
16+
{{- $title = printf "%sOptional" $title -}}
1617
{{- end -}}
1718

1819
{{- if eq $parentType "course" -}}
19-
{{- $title = printf "%sTest %s" $title $weight -}}
20+
{{- $title = printf "%s Test" $title -}}
2021
{{- end -}}
2122

2223
{{- if eq $parentType "module" -}}
23-
{{- $title = printf "%sQuiz %s" $title $weight -}}
24+
{{- $title = printf "%s Quiz" $title -}}
2425
{{- end -}}
2526

2627
{{- if or (eq $parentType "learning-path") (eq $parentType "challenge") (eq $parentType "certification") -}}
27-
{{- $title = printf "%sExam %s" $title $weight -}}
28+
{{- $title = printf "%s Exam" $title -}}
2829
{{- end -}}
2930

31+
{{- if not $isFinal -}}
32+
{{- $title = printf "%s - %d" $title $index -}}
33+
{{- end -}}
3034

3135
{{- return $title -}}

layouts/partials/title.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{{- $page := . -}}
2+
3+
{{- $title := $page.Title -}}
4+
5+
{{- if eq $page.Type "test" -}}
6+
{{- $title = partial "test/title.html" $page -}}
7+
{{- end -}}
8+
9+
{{- return $title -}}

0 commit comments

Comments
 (0)