Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MACAO Hugo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MACAO
MACAO Hugo
Commits
05c8b697
Commit
05c8b697
authored
1 month ago
by
David Rouquet
Browse files
Options
Downloads
Patches
Plain Diff
transcript image in quiz sumary
parent
330ffea4
No related branches found
No related tags found
No related merge requests found
Pipeline
#2083
passed
1 month ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
macao/assets/quiz.js
+44
-29
44 additions, 29 deletions
macao/assets/quiz.js
with
44 additions
and
29 deletions
macao/assets/quiz.js
+
44
−
29
View file @
05c8b697
...
@@ -49,6 +49,8 @@ function toggleHelpComment(question, htmlElement) {
...
@@ -49,6 +49,8 @@ function toggleHelpComment(question, htmlElement) {
let
correctIndic
;
let
correctIndic
;
// The following allows to define complementary attributes in survey JSONS
$
(
function
()
{
$
(
function
()
{
correctIndic
=
{
correctIndic
=
{
node
:
document
.
getElementById
(
"
correct-indic
"
),
node
:
document
.
getElementById
(
"
correct-indic
"
),
...
@@ -80,7 +82,6 @@ $(function () {
...
@@ -80,7 +82,6 @@ $(function () {
visibleIndex
:
0
,
visibleIndex
:
0
,
});
});
// Add compComment to the metadata
Survey
.
JsonObject
.
metaData
.
addProperty
(
"
question
"
,
{
Survey
.
JsonObject
.
metaData
.
addProperty
(
"
question
"
,
{
name
:
"
compComment
"
,
name
:
"
compComment
"
,
type
:
"
text
"
,
type
:
"
text
"
,
...
@@ -89,6 +90,15 @@ $(function () {
...
@@ -89,6 +90,15 @@ $(function () {
visibleIndex
:
0
,
visibleIndex
:
0
,
});
});
Survey
.
JsonObject
.
metaData
.
addProperty
(
"
question
"
,
{
name
:
"
transcript
"
,
type
:
"
text
"
,
category
:
"
general
"
,
default
:
""
,
visibleIndex
:
0
,
});
// Load survey model from JSON
// Load survey model from JSON
const
survey
=
new
Survey
.
Model
(
jsonStatic
);
const
survey
=
new
Survey
.
Model
(
jsonStatic
);
const
questions
=
survey
.
getAllQuestions
();
const
questions
=
survey
.
getAllQuestions
();
...
@@ -175,7 +185,6 @@ $(function () {
...
@@ -175,7 +185,6 @@ $(function () {
});
});
survey
.
onComplete
.
add
(
function
(
sender
)
{
survey
.
onComplete
.
add
(
function
(
sender
)
{
if
(
sender
.
isSurveySummaryVisible
)
{
if
(
sender
.
isSurveySummaryVisible
)
{
console
.
log
(
"
Survey summary is visible
"
);
console
.
log
(
"
Survey summary is visible
"
);
const
userData
=
sender
.
data
;
const
userData
=
sender
.
data
;
...
@@ -187,26 +196,32 @@ $(function () {
...
@@ -187,26 +196,32 @@ $(function () {
const
userAnswer
=
userData
[
q
.
name
];
const
userAnswer
=
userData
[
q
.
name
];
const
correctAnswer
=
q
.
correctAnswer
;
const
correctAnswer
=
q
.
correctAnswer
;
const
isCorrect
=
userAnswer
===
correctAnswer
;
const
isCorrect
=
userAnswer
===
correctAnswer
;
html
+=
`<li><b>
${
q
.
title
}
</b><br>
html
+=
`<li><b>
${
q
.
title
}
</b><br>
Your answer:
${
userAnswer
}
<br>
Your answer:
${
userAnswer
}
<br>
Correct answer:
${
correctAnswer
}
<br>
Correct answer:
${
correctAnswer
}
<br>
<span style="color:
${
isCorrect
?
'
green
'
:
'
red
'
}
;">
<span style="color:
${
isCorrect
?
'
green
'
:
'
red
'
}
;">
${
isCorrect
?
"
Correct
"
:
"
Incorrect
"
}
${
isCorrect
?
"
Correct
"
:
"
Incorrect
"
}
</span>
</span>`
;
</li><br>`
;
// Check if the transcript property exists and add an image if it does
if
(
q
.
transcript
)
{
html
+=
`<br><img src="
${
q
.
transcript
}
" alt="Transcript Image" class="inlineImage">`
;
}
html
+=
`</li><br>`
;
});
});
html
+=
"
</ul>
"
;
html
+=
"
</ul>
"
;
summaryDiv
.
innerHTML
=
html
;
summaryDiv
.
innerHTML
=
html
;
// Append the summary after the survey container
// Append the summary after the survey container
document
.
getElementById
(
"
surveyContainer
"
).
appendChild
(
summaryDiv
);
document
.
getElementById
(
"
surveyContainer
"
).
appendChild
(
summaryDiv
);
}
}
});
});
// Ugly tricks to avoid creating a new theme
// Ugly tricks to avoid creating a new theme
const
customTheme
=
SurveyTheme
.
DefaultLightPanelless
;
const
customTheme
=
SurveyTheme
.
DefaultLightPanelless
;
const
primColor
=
getComputedStyle
(
document
.
documentElement
,
null
).
getPropertyValue
(
'
--macao-primary-color
'
);
const
primColor
=
getComputedStyle
(
document
.
documentElement
,
null
).
getPropertyValue
(
'
--macao-primary-color
'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment