Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Paul-Elliot Anglès d'Auriac
class-panic
Commits
0c126dc5
Commit
0c126dc5
authored
Oct 12, 2018
by
Paul-Elliot Anglès d'Auriac
Browse files
correction bug
parent
1f5ef55e
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/javascripts/admin.js
View file @
0c126dc5
...
...
@@ -126,7 +126,7 @@ addReponse = function (event) {
removeReponse
=
function
(
elem
)
{
while
(
!
elem
.
classList
.
contains
(
"
reponse
"
))
{
elem
=
elem
.
parentNode
}
elem
.
parentNode
.
remove
();
elem
.
remove
();
}
sendReponse
=
function
()
{
...
...
@@ -185,11 +185,17 @@ function addTextarea(elem) {
console
.
log
(
"
elem.textContent
"
,
elem
.
textContent
);
if
(
elem
.
textContent
==
"
Ajouter un textarea
"
)
{
elem
.
textContent
=
"
Enlever le textarea
"
;
elem
.
classList
.
add
(
"
isTexted
"
);
elem
.
outerHTML
+=
"
<textarea class='textCorrect' style='display:block;width:100%;' placeholder='Correction ou justification'></textarea>
"
}
else
{
elem
.
textContent
=
"
Ajouter un textarea
"
elem
.
nextSibling
.
remove
()
// elem.nextSibling.remove()
reponseElem
=
elem
;
while
(
!
reponseElem
.
classList
.
contains
(
"
reponse
"
))
{
reponseElem
=
reponseElem
.
parentNode
}
reponseElem
.
querySelector
(
"
.textCorrect
"
).
remove
();
}
}
...
...
@@ -199,6 +205,8 @@ function modifyQuestion() {
question
.
contentEditable
=
true
;
question
.
textContent
=
currentQuestionOfAdmin
.
enonce
;
document
.
querySelectorAll
(
"
#wrapperAnswer .reponse
"
).
forEach
((
reponse
,
index
)
=>
{
if
(
index
==
currentQuestionOfAdmin
.
correct
)
reponse
.
classList
.
add
(
"
vrai
"
);
reponse
.
textContent
=
currentQuestionOfAdmin
.
reponses
[
index
].
reponse
;
reponse
.
innerHTML
=
"
<span class='text' contentEditable='true'>
"
+
reponse
.
innerHTML
+
"
</span>
"
;
if
(
currentQuestionOfAdmin
.
reponses
[
index
].
texted
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment