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
a2e3724d
Commit
a2e3724d
authored
Apr 10, 2014
by
Xavier Antoviaque
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16 from aboudreault/remove-show-answer
Remove show answer
parents
4fb8d0bc
bf986ecf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
71 deletions
+7
-71
mentoring/mentoring.py
+4
-0
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/mentoring.py
View file @
a2e3724d
...
@@ -132,6 +132,10 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -132,6 +132,10 @@ class MentoringBlock(XBlockWithLightChildren):
if
self
.
completed
:
if
self
.
completed
:
completed
=
True
completed
=
True
# server-side check to not set completion if the max_attempts is reached
if
self
.
max_attempts
>
0
and
self
.
num_attempts
>=
self
.
max_attempts
:
completed
=
False
if
completed
:
if
completed
:
message
=
self
.
get_message_html
(
'completed'
)
message
=
self
.
get_message_html
(
'completed'
)
else
:
else
:
...
...
mentoring/public/css/questionnaire.css
View file @
a2e3724d
...
@@ -78,7 +78,3 @@
...
@@ -78,7 +78,3 @@
.mentoring
.choices-list
.choice-selector
{
.mentoring
.choices-list
.choice-selector
{
margin-right
:
5px
;
margin-right
:
5px
;
}
}
.mentoring
.show-answer
{
display
:
none
;
}
mentoring/public/js/questionnaire.js
View file @
a2e3724d
...
@@ -94,20 +94,7 @@ function MCQBlock(runtime, element) {
...
@@ -94,20 +94,7 @@ function MCQBlock(runtime, element) {
function
MRQBlock
(
runtime
,
element
)
{
function
MRQBlock
(
runtime
,
element
)
{
return
{
return
{
init
:
function
()
{
var
answerButton
=
$
(
'button'
,
element
);
answerButton
.
on
(
'click'
,
_
.
bind
(
this
.
toggleAnswers
,
this
));
this
.
showAnswerButton
();
},
submit
:
function
()
{
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
),
var
checkedCheckboxes
=
$
(
'input[type=checkbox]:checked'
,
element
),
checkedValues
=
[];
checkedValues
=
[];
...
@@ -125,24 +112,17 @@ function MRQBlock(runtime, element) {
...
@@ -125,24 +112,17 @@ function MRQBlock(runtime, element) {
result
.
message
+
'</div>'
);
result
.
message
+
'</div>'
);
}
}
var
answers
=
[];
// used in displayAnswers
$
.
each
(
result
.
choices
,
function
(
index
,
choice
)
{
$
.
each
(
result
.
choices
,
function
(
index
,
choice
)
{
var
choiceInputDOM
=
$
(
'.choice input[value='
+
choice
.
value
+
']'
,
element
),
var
choiceInputDOM
=
$
(
'.choice input[value='
+
choice
.
value
+
']'
,
element
),
choiceDOM
=
choiceInputDOM
.
closest
(
'.choice'
),
choiceDOM
=
choiceInputDOM
.
closest
(
'.choice'
),
choiceResultDOM
=
$
(
'.choice-result'
,
choiceDOM
),
choiceResultDOM
=
$
(
'.choice-result'
,
choiceDOM
),
choiceAnswerDOM
=
$
(
'.choice-answer'
,
choiceDOM
),
choiceTipsDOM
=
$
(
'.choice-tips'
,
choiceDOM
),
choiceTipsDOM
=
$
(
'.choice-tips'
,
choiceDOM
),
choiceTipsCloseDOM
;
choiceTipsCloseDOM
;
/* update our answers dict */
answers
.
push
({
input
:
choiceInputDOM
,
answer
:
choice
.
completed
?
choiceInputDOM
.
attr
(
'checked'
)
:
!
choiceInputDOM
.
attr
(
'checked'
)
});
choiceResultDOM
.
removeClass
(
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 */
/* show hint if checked or max_attempts is disabled */
if
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
)
{
if
(
result
.
completed
||
choiceInputDOM
.
prop
(
'checked'
)
||
options
.
max_attempts
<=
0
)
{
if
(
choice
.
completed
)
{
if
(
choice
.
completed
)
{
...
@@ -159,46 +139,8 @@ function MRQBlock(runtime, element) {
...
@@ -159,46 +139,8 @@ function MRQBlock(runtime, element) {
messageView
.
showMessage
(
choiceTipsDOM
);
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 @
a2e3724d
...
@@ -14,15 +14,9 @@
...
@@ -14,15 +14,9 @@
</input>
</input>
</label>
</label>
</div>
</div>
<span
class=
"choice-answer icon-2x"
></span>
<div
class=
"choice-tips"
></div>
<div
class=
"choice-tips"
></div>
</div>
</div>
{% endfor %}
{% endfor %}
{{feedback.body_html|safe}}
{{feedback.body_html|safe}}
</div>
</div>
</fieldset>
</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