Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
problem-builder
Commits
fd3e1723
Commit
fd3e1723
authored
Apr 07, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove show answer
parent
4fb8d0bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
71 deletions
+3
-71
mentoring/public/css/questionnaire.css
+0
-4
mentoring/public/js/questionnaire.js
+3
-61
mentoring/templates/html/mrqblock_choices.html
+0
-6
No files found.
mentoring/public/css/questionnaire.css
View file @
fd3e1723
...
...
@@ -78,7 +78,3 @@
.mentoring
.choices-list
.choice-selector
{
margin-right
:
5px
;
}
.mentoring
.show-answer
{
display
:
none
;
}
mentoring/public/js/questionnaire.js
View file @
fd3e1723
...
...
@@ -94,20 +94,7 @@ function MCQBlock(runtime, element) {
function
MRQBlock
(
runtime
,
element
)
{
return
{
init
:
function
()
{
var
answerButton
=
$
(
'button'
,
element
);
answerButton
.
on
(
'click'
,
_
.
bind
(
this
.
toggleAnswers
,
this
));
this
.
showAnswerButton
();
},
submit
:
function
()
{
// hide answers
var
choiceInputDOM
=
$
(
'.choice input'
,
element
),
choiceResultDOM
=
$
(
'.choice-answer'
,
choiceInputDOM
.
closest
(
'.choice'
));
choiceResultDOM
.
removeClass
(
'checkmark-incorrect icon-exclamation fa-exclamation checkmark-correct icon-ok fa-check'
);
var
checkedCheckboxes
=
$
(
'input[type=checkbox]:checked'
,
element
),
checkedValues
=
[];
...
...
@@ -125,24 +112,17 @@ function MRQBlock(runtime, element) {
result
.
message
+
'</div>'
);
}
var
answers
=
[];
// used in displayAnswers
$
.
each
(
result
.
choices
,
function
(
index
,
choice
)
{
var
choiceInputDOM
=
$
(
'.choice input[value='
+
choice
.
value
+
']'
,
element
),
choiceDOM
=
choiceInputDOM
.
closest
(
'.choice'
),
choiceResultDOM
=
$
(
'.choice-result'
,
choiceDOM
),
choiceAnswerDOM
=
$
(
'.choice-answer'
,
choiceDOM
),
choiceTipsDOM
=
$
(
'.choice-tips'
,
choiceDOM
),
choiceTipsCloseDOM
;
/* update our answers dict */
answers
.
push
({
input
:
choiceInputDOM
,
answer
:
choice
.
completed
?
choiceInputDOM
.
attr
(
'checked'
)
:
!
choiceInputDOM
.
attr
(
'checked'
)
});
choiceResultDOM
.
removeClass
(
'checkmark-incorrect icon-exclamation
fa-exclamation
checkmark-correct icon-ok fa-check'
'checkmark-incorrect icon-exclamation checkmark-correct icon-ok fa-check'
);
/* show hint if checked or max_attempts is disabled */
if
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
)
{
if
(
choice
.
completed
)
{
...
...
@@ -159,46 +139,8 @@ function MRQBlock(runtime, element) {
messageView
.
showMessage
(
choiceTipsDOM
);
});
choiceAnswerDOM
.
off
(
'click'
).
on
(
'click'
,
function
()
{
messageView
.
showMessage
(
choiceTipsDOM
);
});
});
this
.
answers
=
answers
;
this
.
showAnswerButton
(
options
);
},
showAnswerButton
:
function
(
options
)
{
var
button
=
$
(
'.show-answer'
,
element
);
var
is_enabled
=
options
&&
(
options
.
num_attempts
>=
options
.
max_attempts
);
if
(
is_enabled
&&
_
.
isArray
(
this
.
answers
))
{
button
.
show
();
}
else
{
button
.
hide
();
}
},
toggleAnswers
:
function
()
{
var
showAnswerButton
=
$
(
'button span'
,
element
);
var
answers_displayed
=
this
.
answers_displayed
=
!
this
.
answers_displayed
;
_
.
each
(
this
.
answers
,
function
(
answer
)
{
var
choiceResultDOM
=
$
(
'.choice-answer'
,
answer
.
input
.
closest
(
'.choice'
));
choiceResultDOM
.
removeClass
(
'checkmark-correct icon-ok fa-check'
);
if
(
answers_displayed
)
{
if
(
answer
.
answer
)
choiceResultDOM
.
addClass
(
'checkmark-correct icon-ok fa-check'
);
showAnswerButton
.
text
(
'Hide Answer(s)'
);
}
else
{
showAnswerButton
.
text
(
'Show Answer(s)'
);
}
});
}
}
};
}
mentoring/templates/html/mrqblock_choices.html
View file @
fd3e1723
...
...
@@ -14,15 +14,9 @@
</input>
</label>
</div>
<span
class=
"choice-answer icon-2x"
></span>
<div
class=
"choice-tips"
></div>
</div>
{% endfor %}
{{feedback.body_html|safe}}
</div>
</fieldset>
<div
class=
"show-answer"
>
<button
class=
"show"
>
<span
class=
"show-label"
>
Show Answer(s)
</span>
</button>
</div>
Write
Preview
Markdown
is supported
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