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
d5c3b58d
Commit
d5c3b58d
authored
Jan 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change reset and next problem code
parent
406d6c0c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
8 deletions
+50
-8
common/lib/xmodule/xmodule/combined_open_ended_module.py
+26
-3
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+23
-4
common/lib/xmodule/xmodule/self_assessment_module.py
+1
-1
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
d5c3b58d
...
...
@@ -176,12 +176,35 @@ class CombinedOpenEndedModule(XModule):
def
update_task_states_ajax
(
self
,
return_html
):
changed
=
self
.
update_task_states
()
if
changed
:
return_html
=
self
.
get_html
()
#return_html=self.get_html()
pass
return
return_html
def
handle_ajax
(
self
,
dispatch
,
get
):
return_html
=
self
.
current_task
.
handle_ajax
(
dispatch
,
get
,
self
.
system
)
return
self
.
update_task_states_ajax
(
return_html
)
"""
This is called by courseware.module_render, to handle an AJAX call.
"get" is request.POST.
Returns a json dictionary:
{ 'progress_changed' : True/False,
'progress': 'none'/'in_progress'/'done',
<other request-specific values here > }
"""
handlers
=
{
'next_problem'
:
self
.
next_problem
,
'reset'
:
self
.
reset
,
}
if
dispatch
not
in
handlers
:
return_html
=
self
.
current_task
.
handle_ajax
(
dispatch
,
get
,
self
.
system
)
return
self
.
update_task_states_ajax
(
return_html
)
def
next_problem
(
self
):
pass
def
reset
(
self
):
pass
def
get_instance_state
(
self
):
"""
...
...
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
d5c3b58d
...
...
@@ -8,7 +8,7 @@ class @CombinedOpenEnded
@
reset_button
=
@
$
(
'.reset-button'
)
@
reset_button
.
click
@
reset
@
combined_open_ended
=
@
$
(
'.combined-open-ended'
)
# valid states: 'initial', 'assessing', '
request_hi
nt', 'done'
# valid states: 'initial', 'assessing', '
post_assessme
nt', 'done'
# Where to put the rubric once we load it
@
el
=
$
(
element
).
find
(
'section.open-ended-child'
)
...
...
@@ -46,7 +46,7 @@ class @CombinedOpenEnded
@
answer_area
.
attr
(
"disabled"
,
true
)
@
submit_button
.
prop
(
'value'
,
'Submit assessment'
)
@
submit_button
.
click
@
save_assessment
else
if
@
child_state
==
'
request_hi
nt'
else
if
@
child_state
==
'
post_assessme
nt'
@
answer_area
.
attr
(
"disabled"
,
true
)
@
submit_button
.
prop
(
'value'
,
'Submit hint'
)
@
submit_button
.
click
@
save_hint
...
...
@@ -88,7 +88,7 @@ class @CombinedOpenEnded
if
response
.
success
@
child_state
=
response
.
state
if
@
child_state
==
'
request_hi
nt'
if
@
child_state
==
'
post_assessme
nt'
@
hint_wrapper
.
html
(
response
.
hint_html
)
@
find_hint_elements
()
else
if
@
child_state
==
'done'
...
...
@@ -104,7 +104,7 @@ class @CombinedOpenEnded
save_hint
:
(
event
)
=>
event
.
preventDefault
()
if
@
child_state
==
'
request_hi
nt'
if
@
child_state
==
'
post_assessme
nt'
data
=
{
'hint'
:
@
hint_area
.
val
()}
$
.
postWithPrefix
"
#{
@
ajax_url
}
/save_hint"
,
data
,
(
response
)
=>
...
...
@@ -135,4 +135,22 @@ class @CombinedOpenEnded
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
next_problem
(
event
)
=>
event
.
preventDefault
()
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
if
@
child_state
==
'done'
$
.
postWithPrefix
"
#{
@
ajax_url
}
/next_problem"
,
{},
(
response
)
=>
if
response
.
success
@
answer_area
.
val
(
''
)
@
rubric_wrapper
.
html
(
''
)
@
hint_wrapper
.
html
(
''
)
@
message_wrapper
.
html
(
''
)
@
child_state
=
'initial'
@
rebind
()
@
reset_button
.
hide
()
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
\ No newline at end of file
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
d5c3b58d
...
...
@@ -58,7 +58,7 @@ class SelfAssessmentModule():
# states
INITIAL
=
'initial'
ASSESSING
=
'assessing'
REQUEST_HINT
=
'
request_hi
nt'
REQUEST_HINT
=
'
post_assessme
nt'
DONE
=
'done'
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
...
...
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