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
c8f7e987
Commit
c8f7e987
authored
1 month ago
by
Anthony
Browse files
Options
Downloads
Patches
Plain Diff
Extract method to create memento related event
parent
1ba10fe8
No related branches found
No related tags found
No related merge requests found
Pipeline
#2080
passed
1 month ago
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
macao/assets/custom.js
+22
-13
22 additions, 13 deletions
macao/assets/custom.js
macao/assets/quiz.js
+7
-0
7 additions, 0 deletions
macao/assets/quiz.js
with
29 additions
and
13 deletions
macao/assets/custom.js
+
22
−
13
View file @
c8f7e987
...
@@ -11,20 +11,7 @@ $(document).ready(function() {
...
@@ -11,20 +11,7 @@ $(document).ready(function() {
// $('.commentaireInfo').prop('popover', 'auto');
// $('.commentaireInfo').prop('popover', 'auto');
$
(
'
.commentaireInfoGroup
'
).
show
();
$
(
'
.commentaireInfoGroup
'
).
show
();
// Comment popover
$
(
'
[spanid]
'
).
addClass
(
'
comment-trigger
'
).
each
(
function
(){
const
spanid
=
$
(
this
).
attr
(
'
spanid
'
);
if
(
$
(
"
[commentaireid=
"
+
spanid
+
"
]
"
).
length
!==
0
)
{
$
(
this
).
popover
({
trigger
:
'
click
'
,
html
:
true
,
placement
:
'
auto
'
,
content
:
$
(
"
[commentaireid=
"
+
spanid
+
"
]
"
)
});
$
(
"
[commentaireid=
"
+
spanid
+
"
]
"
).
toggle
()
}
});
// $(document).on('click', function() {
// $(document).on('click', function() {
// $('[spanid]').popover('hide');
// $('[spanid]').popover('hide');
...
@@ -46,3 +33,25 @@ $(document).ready(function() {
...
@@ -46,3 +33,25 @@ $(document).ready(function() {
$
(
'
.book-icon
'
).
hide
();
$
(
'
.book-icon
'
).
hide
();
}
}
});
});
// Memento popover
// This function adds a popover to elements with the attribute spanid
// that have a corresponding commentaireid element.
const
addMementoEvent
=
function
(){
$
(
'
[spanid]:not(.comment-trigger)
'
).
addClass
(
'
comment-trigger
'
).
each
(
function
(){
const
spanid
=
$
(
this
).
attr
(
'
spanid
'
);
if
(
$
(
"
[commentaireid=
"
+
spanid
+
"
]
"
).
length
!==
0
)
{
$
(
this
).
popover
({
trigger
:
'
click
'
,
html
:
true
,
placement
:
'
auto
'
,
content
:
$
(
"
[commentaireid=
"
+
spanid
+
"
]
"
)
});
$
(
"
[commentaireid=
"
+
spanid
+
"
]
"
).
toggle
()
}
});
}
// Add addMementoEvent to the global scope
window
.
addMementoEvent
=
addMementoEvent
;
This diff is collapsed.
Click to expand it.
macao/assets/quiz.js
+
7
−
0
View file @
c8f7e987
...
@@ -17,6 +17,8 @@ function checkAllQuestions(questions, surveyConfig, converter) {
...
@@ -17,6 +17,8 @@ function checkAllQuestions(questions, surveyConfig, converter) {
surveyConfig
.
incorrectComment
=
surveyConfig
.
incorrectComment
.
replace
(
/
\n\n
/g
,
"
<br>
"
);
surveyConfig
.
incorrectComment
=
surveyConfig
.
incorrectComment
.
replace
(
/
\n\n
/g
,
"
<br>
"
);
correctIndic
.
commentNode
.
innerHTML
=
converter
.
renderInline
(
surveyConfig
.
incorrectComment
)
||
"
Some answers are incorrect!
"
;
correctIndic
.
commentNode
.
innerHTML
=
converter
.
renderInline
(
surveyConfig
.
incorrectComment
)
||
"
Some answers are incorrect!
"
;
}
}
window
.
addMementoEvent
();
}
}
/**
/**
...
@@ -152,6 +154,11 @@ $(function () {
...
@@ -152,6 +154,11 @@ $(function () {
}
}
});
});
survey
.
onAfterRenderSurvey
.
add
((
survey
,
options
)
=>
{
window
.
addMementoEvent
();
});
// Add "Check answers" button
// Add "Check answers" button
survey
.
addNavigationItem
({
survey
.
addNavigationItem
({
id
:
"
sv-nav-check
"
,
id
:
"
sv-nav-check
"
,
...
...
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