Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
b4956cf1
Commit
b4956cf1
authored
Mar 09, 2017
by
Albert St. Aubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates to add a show answer notification and update focus when the notification is shown.
TNL-6356
parent
ee68726b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
19 deletions
+34
-19
common/lib/xmodule/xmodule/css/capa/display.scss
+4
-0
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
+0
-14
common/lib/xmodule/xmodule/js/src/capa/display.js
+9
-2
common/static/sass/edx-pattern-library-shims/base/_variables.scss
+2
-0
common/test/acceptance/pages/lms/problem.py
+9
-0
common/test/acceptance/tests/lms/test_problem_types.py
+3
-3
lms/templates/problem.html
+7
-0
No files found.
common/lib/xmodule/xmodule/css/capa/display.scss
View file @
b4956cf1
...
@@ -1042,6 +1042,10 @@ div.problem {
...
@@ -1042,6 +1042,10 @@ div.problem {
@include
notification-by-type
(
$warning-color
);
@include
notification-by-type
(
$warning-color
);
}
}
&
.general
{
@include
notification-by-type
(
$general-color-accent
);
}
&
.problem-hint
{
&
.problem-hint
{
border
:
1px
solid
$uxpl-gray-background
;
border
:
1px
solid
$uxpl-gray-background
;
border-radius
:
6px
;
border-radius
:
6px
;
...
...
common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee
View file @
b4956cf1
...
@@ -438,25 +438,11 @@ describe 'Problem', ->
...
@@ -438,25 +438,11 @@ describe 'Problem', ->
expect
(
$
(
'#answer_1_1'
)).
toHaveHtml
'One'
expect
(
$
(
'#answer_1_1'
)).
toHaveHtml
'One'
expect
(
$
(
'#answer_1_2'
)).
toHaveHtml
'Two'
expect
(
$
(
'#answer_1_2'
)).
toHaveHtml
'Two'
it
'sends a message to the window SR element'
,
->
spyOn
(
$
,
'postWithPrefix'
).
and
.
callFake
(
url
,
callback
)
->
callback
(
answers
:
{})
@
problem
.
show
()
expect
(
window
.
SR
.
readText
).
toHaveBeenCalledWith
'Answers to this problem are now shown. Navigate through the problem to review it with answers inline.'
it
'disables the show answer button'
,
->
it
'disables the show answer button'
,
->
spyOn
(
$
,
'postWithPrefix'
).
and
.
callFake
(
url
,
callback
)
->
callback
(
answers
:
{})
spyOn
(
$
,
'postWithPrefix'
).
and
.
callFake
(
url
,
callback
)
->
callback
(
answers
:
{})
@
problem
.
show
()
@
problem
.
show
()
expect
(
@
problem
.
el
.
find
(
'.show'
).
attr
(
'disabled'
)).
toEqual
(
'disabled'
)
expect
(
@
problem
.
el
.
find
(
'.show'
).
attr
(
'disabled'
)).
toEqual
(
'disabled'
)
it
'sends a SR message when answer is present'
,
->
spyOn
(
$
,
'postWithPrefix'
).
and
.
callFake
(
url
,
callback
)
->
callback
answers
:
'1_1'
:
'answers'
@
problem
.
show
()
expect
(
window
.
SR
.
readText
).
toHaveBeenCalledWith
'Answers to this problem are now shown. Navigate through the problem to review it with answers inline.'
describe
'radio text question'
,
->
describe
'radio text question'
,
->
radio_text_xml
=
'''
radio_text_xml
=
'''
<section class="problem">
<section class="problem">
...
...
common/lib/xmodule/xmodule/js/src/capa/display.js
View file @
b4956cf1
...
@@ -174,6 +174,7 @@
...
@@ -174,6 +174,7 @@
this
.
showButton
.
click
(
this
.
show
);
this
.
showButton
.
click
(
this
.
show
);
this
.
saveButton
=
this
.
$
(
'.action .save'
);
this
.
saveButton
=
this
.
$
(
'.action .save'
);
this
.
saveNotification
=
this
.
$
(
'.notification-save'
);
this
.
saveNotification
=
this
.
$
(
'.notification-save'
);
this
.
showAnswerNotification
=
this
.
$
(
'.notification-show-answer'
);
this
.
saveButton
.
click
(
this
.
save
);
this
.
saveButton
.
click
(
this
.
save
);
this
.
gentleAlertNotification
=
this
.
$
(
'.notification-gentle-alert'
);
this
.
gentleAlertNotification
=
this
.
$
(
'.notification-gentle-alert'
);
this
.
submitNotification
=
this
.
$
(
'.notification-submit'
);
this
.
submitNotification
=
this
.
$
(
'.notification-submit'
);
...
@@ -727,8 +728,9 @@
...
@@ -727,8 +728,9 @@
}
}
that
.
el
.
find
(
'.show'
).
attr
(
'disabled'
,
'disabled'
);
that
.
el
.
find
(
'.show'
).
attr
(
'disabled'
,
'disabled'
);
that
.
updateProgress
(
response
);
that
.
updateProgress
(
response
);
window
.
SR
.
readText
(
gettext
(
'Answers to this problem are now shown. Navigate through the problem to review it with answers inline.'
));
// eslint-disable-line max-len
that
.
clear_all_notifications
();
that
.
scroll_to_problem_meta
();
that
.
showAnswerNotification
.
show
();
that
.
focus_on_notification
(
'show-answer'
);
});
});
};
};
...
@@ -736,6 +738,8 @@
...
@@ -736,6 +738,8 @@
this
.
submitNotification
.
remove
();
this
.
submitNotification
.
remove
();
this
.
gentleAlertNotification
.
hide
();
this
.
gentleAlertNotification
.
hide
();
this
.
saveNotification
.
hide
();
this
.
saveNotification
.
hide
();
this
.
showAnswerNotification
.
hide
();
};
};
Problem
.
prototype
.
gentle_alert
=
function
(
msg
)
{
Problem
.
prototype
.
gentle_alert
=
function
(
msg
)
{
...
@@ -848,6 +852,7 @@
...
@@ -848,6 +852,7 @@
if
(
bind
)
{
if
(
bind
)
{
$
(
textField
).
on
(
'input'
,
function
()
{
$
(
textField
).
on
(
'input'
,
function
()
{
that
.
saveNotification
.
hide
();
that
.
saveNotification
.
hide
();
that
.
showAnswerNotification
.
hide
();
that
.
submitAnswersAndSubmitButton
();
that
.
submitAnswersAndSubmitButton
();
});
});
}
}
...
@@ -867,6 +872,7 @@
...
@@ -867,6 +872,7 @@
if
(
bind
)
{
if
(
bind
)
{
$
(
checkboxOrRadio
).
on
(
'click'
,
function
()
{
$
(
checkboxOrRadio
).
on
(
'click'
,
function
()
{
that
.
saveNotification
.
hide
();
that
.
saveNotification
.
hide
();
that
.
showAnswerNotification
.
hide
();
that
.
submitAnswersAndSubmitButton
();
that
.
submitAnswersAndSubmitButton
();
});
});
}
}
...
@@ -884,6 +890,7 @@
...
@@ -884,6 +890,7 @@
if
(
bind
)
{
if
(
bind
)
{
$
(
selectField
).
on
(
'change'
,
function
()
{
$
(
selectField
).
on
(
'change'
,
function
()
{
that
.
saveNotification
.
hide
();
that
.
saveNotification
.
hide
();
that
.
showAnswerNotification
.
hide
();
that
.
submitAnswersAndSubmitButton
();
that
.
submitAnswersAndSubmitButton
();
});
});
}
}
...
...
common/static/sass/edx-pattern-library-shims/base/_variables.scss
View file @
b4956cf1
...
@@ -143,6 +143,8 @@ $error-color: rgb(203, 7, 18) !default;
...
@@ -143,6 +143,8 @@ $error-color: rgb(203, 7, 18) !default;
$success-color
:
rgb
(
0
,
155
,
0
)
!
default
;
$success-color
:
rgb
(
0
,
155
,
0
)
!
default
;
$warning-color
:
rgb
(
255
,
192
,
31
)
!
default
;
$warning-color
:
rgb
(
255
,
192
,
31
)
!
default
;
$warning-color-accent
:
rgb
(
255
,
252
,
221
)
!
default
;
$warning-color-accent
:
rgb
(
255
,
252
,
221
)
!
default
;
$general-color
:
$uxpl-blue-base
!
default
;;
$general-color-accent
:
$uxpl-blue-base
!
default
//
CAPA
correctness
color
to
be
consistent
with
Alert
styles
above
//
CAPA
correctness
color
to
be
consistent
with
Alert
styles
above
...
...
common/test/acceptance/pages/lms/problem.py
View file @
b4956cf1
...
@@ -200,6 +200,15 @@ class ProblemPage(PageObject):
...
@@ -200,6 +200,15 @@ class ProblemPage(PageObject):
self
.
wait_for
(
lambda
:
self
.
q
(
css
=
'.notification.warning.notification-gentle-alert'
)
.
focused
,
self
.
wait_for
(
lambda
:
self
.
q
(
css
=
'.notification.warning.notification-gentle-alert'
)
.
focused
,
'Waiting for the focus to be on the gentle alert notification'
)
'Waiting for the focus to be on the gentle alert notification'
)
def
wait_for_show_answer_notification
(
self
):
"""
Wait for the show answer Notification to be present
"""
self
.
wait_for_element_visibility
(
'.notification.general.notification-show-answer'
,
'Waiting for Show Answer notification to be visible'
)
self
.
wait_for
(
lambda
:
self
.
q
(
css
=
'.notification.general.notification-show-answer'
)
.
focused
,
'Waiting for the focus to be on the show answer notification'
)
def
is_gentle_alert_notification_visible
(
self
):
def
is_gentle_alert_notification_visible
(
self
):
"""
"""
Is the Gentle Alert Notification visible?
Is the Gentle Alert Notification visible?
...
...
common/test/acceptance/tests/lms/test_problem_types.py
View file @
b4956cf1
...
@@ -278,7 +278,7 @@ class ProblemTypeTestMixin(ProblemTypeA11yTestMixin):
...
@@ -278,7 +278,7 @@ class ProblemTypeTestMixin(ProblemTypeA11yTestMixin):
And I should see the problem title is focused
And I should see the problem title is focused
"""
"""
self
.
problem_page
.
click_show
()
self
.
problem_page
.
click_show
()
self
.
problem_page
.
wait_for_
focus_on_problem_meta
()
self
.
problem_page
.
wait_for_
show_answer_notification
()
@attr
(
shard
=
7
)
@attr
(
shard
=
7
)
def
test_save_reaction
(
self
):
def
test_save_reaction
(
self
):
...
@@ -495,7 +495,7 @@ class CheckboxProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
...
@@ -495,7 +495,7 @@ class CheckboxProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
self
.
problem_page
.
click_show
()
self
.
problem_page
.
click_show
()
self
.
assertTrue
(
self
.
problem_page
.
is_solution_tag_present
())
self
.
assertTrue
(
self
.
problem_page
.
is_solution_tag_present
())
self
.
assertTrue
(
self
.
problem_page
.
is_correct_choice_highlighted
(
correct_choices
=
[
1
,
3
]))
self
.
assertTrue
(
self
.
problem_page
.
is_correct_choice_highlighted
(
correct_choices
=
[
1
,
3
]))
self
.
problem_page
.
wait_for_
focus_on_problem_meta
()
self
.
problem_page
.
wait_for_
show_answer_notification
()
class
MultipleChoiceProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
class
MultipleChoiceProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
...
@@ -562,7 +562,7 @@ class MultipleChoiceProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
...
@@ -562,7 +562,7 @@ class MultipleChoiceProblemTypeTest(ProblemTypeTestBase, ProblemTypeTestMixin):
self
.
assertTrue
(
self
.
problem_page
.
is_correct_choice_highlighted
(
correct_choices
=
[
3
]))
self
.
assertTrue
(
self
.
problem_page
.
is_correct_choice_highlighted
(
correct_choices
=
[
3
]))
# Finally, make sure that clicking Show Answer moved focus to the correct place.
# Finally, make sure that clicking Show Answer moved focus to the correct place.
self
.
problem_page
.
wait_for_
focus_on_problem_meta
()
self
.
problem_page
.
wait_for_
show_answer_notification
()
class
RadioProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
class
RadioProblemTypeTest
(
ProblemTypeTestBase
,
ProblemTypeTestMixin
):
...
...
lms/templates/problem.html
View file @
b4956cf1
...
@@ -106,4 +106,11 @@ from openedx.core.djangolib.markup import HTML
...
@@ -106,4 +106,11 @@ from openedx.core.djangolib.markup import HTML
notification_message=save_message,
notification_message=save_message,
is_hidden=not has_saved_answers"
is_hidden=not has_saved_answers"
/>
/>
<
%
include
file=
"problem_notifications.html"
args=
"
notification_type='general',
notification_icon='fa-info-circle',
notification_name='show-answer',
notification_message=_('Answers are displayed within the problem'),
is_hidden=True"
/>
</div>
</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