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
77eee1ac
Commit
77eee1ac
authored
Apr 01, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MCQ choices tips are now displayed in a blue popup like MRQ
parent
c520ab40
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
10 deletions
+50
-10
mentoring/mcq.py
+14
-6
mentoring/public/css/questionnaire.css
+4
-0
mentoring/public/js/questionnaire.js
+30
-4
mentoring/templates/html/mcqblock_choices.html
+2
-0
No files found.
mentoring/mcq.py
View file @
77eee1ac
...
...
@@ -59,15 +59,23 @@ class MCQBlock(QuestionnaireAbstractBlock):
if
submission
in
tip
.
display_with_defaults
:
tips_fragments
.
append
(
tip
.
render
())
formatted_tips
=
render_template
(
'templates/html/tip_question_group.html'
,
{
'self'
:
self
,
'tips_fragments'
:
tips_fragments
,
'submission'
:
submission
,
'submission_display'
:
self
.
get_submission_display
(
submission
),
})
if
self
.
type
==
'rating'
:
formatted_tips
=
render_template
(
'templates/html/tip_question_group.html'
,
{
'self'
:
self
,
'tips_fragments'
:
tips_fragments
,
'submission'
:
submission
,
'submission_display'
:
self
.
get_submission_display
(
submission
),
})
else
:
formatted_tips
=
render_template
(
'templates/html/tip_choice_group.html'
,
{
'self'
:
self
,
'tips_fragments'
:
tips_fragments
,
'completed'
:
completed
,
})
self
.
student_choice
=
submission
result
=
{
'type'
:
self
.
type
,
'submission'
:
submission
,
'completed'
:
completed
,
'tips'
:
formatted_tips
,
...
...
mentoring/public/css/questionnaire.css
View file @
77eee1ac
...
...
@@ -78,6 +78,10 @@
color
:
#fff
;
}
.mentoring
.choices
.choice-message
p
{
color
:
#fff
;
}
.mentoring
.rating
.choice
{
margin-right
:
10px
;
}
...
...
mentoring/public/js/questionnaire.js
View file @
77eee1ac
...
...
@@ -14,12 +14,39 @@ function MCQBlock(runtime, element) {
},
handleSubmit
:
function
(
result
)
{
if
(
result
.
type
==
'rating'
)
{
var
tipsDom
=
$
(
element
).
parent
().
find
(
'.messages'
),
tipHtml
=
(
result
||
{}).
tips
||
''
;
if
(
tipHtml
)
{
tipsDom
.
append
(
tipHtml
);
if
(
tipHtml
)
tipsDom
.
append
(
tipHtml
);
}
else
{
// choices
var
messageDOM
=
$
(
'.choice-message'
,
element
),
allPopupsDOM
=
$
(
'.choice-tips, .choice-message'
,
element
),
clearPopupEvents
=
function
()
{
allPopupsDOM
.
hide
();
$
(
'.close'
,
allPopupsDOM
).
off
(
'click'
);
},
showPopup
=
function
(
popupDOM
)
{
clearPopupEvents
();
popupDOM
.
show
();
popupDOM
.
on
(
'click'
,
function
()
{
clearPopupEvents
();
});
};
if
(
_
.
isNull
(
result
.
submission
))
{
messageDOM
.
html
(
'<div class="message-content"><div class="close"></div>'
+
'You have not provided an answer.'
+
'</div>'
);
showPopup
(
messageDOM
);
}
else
if
(
result
.
tips
)
{
messageDOM
.
html
(
result
.
tips
);
showPopup
(
messageDOM
);
}
}
}
};
}
...
...
@@ -70,8 +97,7 @@ function MRQBlock(runtime, element) {
popupDOM
.
show
();
popupDOM
.
on
(
'click'
,
function
()
{
clearPopupEvents
();
choiceTipsDOM
.
hide
();
clearPopupEvents
();
});
};
...
...
mentoring/templates/html/mcqblock_choices.html
View file @
77eee1ac
...
...
@@ -8,6 +8,8 @@
<input
class=
"choice-selector"
type=
"radio"
name=
"{{ self.name }}"
value=
"{{ choice.value }}"
{%
if
self
.
student_choice =
=
choice
.
value
%}
checked
{%
endif
%}
>
{{ choice.content }}
</label>
</div>
<div
class=
"choice-tips"
></div>
{% endfor %}
<div
class=
"choice-message"
></div>
</div>
</fieldset>
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