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
6ef8713c
Commit
6ef8713c
authored
Jan 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JS state tracking
parent
91a9962b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
7 deletions
+29
-7
common/lib/xmodule/xmodule/combined_open_ended_module.py
+24
-3
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+3
-2
common/lib/xmodule/xmodule/self_assessment_module.py
+1
-1
lms/templates/combined_open_ended.html
+1
-1
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
6ef8713c
...
@@ -131,6 +131,7 @@ class CombinedOpenEndedModule(XModule):
...
@@ -131,6 +131,7 @@ class CombinedOpenEndedModule(XModule):
'items'
:
[{
'content'
:
task_html
}],
'items'
:
[{
'content'
:
task_html
}],
'ajax_url'
:
self
.
system
.
ajax_url
,
'ajax_url'
:
self
.
system
.
ajax_url
,
'allow_reset'
:
True
,
'allow_reset'
:
True
,
'state'
:
self
.
state
,
}
}
html
=
self
.
system
.
render_template
(
'combined_open_ended.html'
,
context
)
html
=
self
.
system
.
render_template
(
'combined_open_ended.html'
,
context
)
...
@@ -201,12 +202,32 @@ class CombinedOpenEndedModule(XModule):
...
@@ -201,12 +202,32 @@ class CombinedOpenEndedModule(XModule):
return
self
.
update_task_states_ajax
(
return_html
)
return
self
.
update_task_states_ajax
(
return_html
)
def
next_problem
(
self
):
def
next_problem
(
self
):
pass
self
.
setup_next_task
()
return
{
'success'
:
True
}
def
reset
(
self
):
def
reset
(
self
):
pass
"""
If resetting is allowed, reset the state.
Returns {'success': bool, 'error': msg}
(error only present if not success)
"""
if
self
.
state
!=
self
.
DONE
:
return
self
.
out_of_sync_error
(
get
)
if
self
.
attempts
>
self
.
max_attempts
:
return
{
'success'
:
False
,
'error'
:
'Too many attempts.'
}
self
.
state
=
self
.
INITIAL
self
.
current_task_number
=
0
self
.
setup_next_task
()
self
.
current_task
.
reset
(
self
.
system
)
return
{
'success'
:
True
}
def
get_instance_state
(
self
):
def
get_instance_state
(
self
):
"""
"""
Get the current score and state
Get the current score and state
"""
"""
...
...
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
6ef8713c
...
@@ -59,6 +59,7 @@ class @CombinedOpenEnded
...
@@ -59,6 +59,7 @@ class @CombinedOpenEnded
@
submit_button
.
hide
()
@
submit_button
.
hide
()
if
!
@
state
==
'done'
if
!
@
state
==
'done'
@
next_problem_button
.
show
()
@
next_problem_button
.
show
()
if
@
state
==
'done'
if
@
allow_reset
if
@
allow_reset
@
reset_button
.
show
()
@
reset_button
.
show
()
else
else
...
@@ -127,7 +128,7 @@ class @CombinedOpenEnded
...
@@ -127,7 +128,7 @@ class @CombinedOpenEnded
reset
:
(
event
)
=>
reset
:
(
event
)
=>
event
.
preventDefault
()
event
.
preventDefault
()
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
if
@
child_
state
==
'done'
if
@
state
==
'done'
$
.
postWithPrefix
"
#{
@
ajax_url
}
/reset"
,
{},
(
response
)
=>
$
.
postWithPrefix
"
#{
@
ajax_url
}
/reset"
,
{},
(
response
)
=>
if
response
.
success
if
response
.
success
@
answer_area
.
val
(
''
)
@
answer_area
.
val
(
''
)
...
@@ -142,7 +143,7 @@ class @CombinedOpenEnded
...
@@ -142,7 +143,7 @@ class @CombinedOpenEnded
else
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
next_problem
(
event
)
=>
next_problem
:
(
event
)
=>
event
.
preventDefault
()
event
.
preventDefault
()
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
if
@
child_state
==
'done'
if
@
child_state
==
'done'
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
6ef8713c
...
@@ -459,7 +459,7 @@ class SelfAssessmentModule():
...
@@ -459,7 +459,7 @@ class SelfAssessmentModule():
'allow_reset'
:
self
.
_allow_reset
()}
'allow_reset'
:
self
.
_allow_reset
()}
def
reset
(
self
,
get
,
system
):
def
reset
(
self
,
system
):
"""
"""
If resetting is allowed, reset the state.
If resetting is allowed, reset the state.
...
...
lms/templates/combined_open_ended.html
View file @
6ef8713c
<section
id=
"combined-open-ended"
class=
"combined-open-ended"
data-ajax-url=
"${ajax_url}"
data-allow_reset=
"${allow_reset}"
>
<section
id=
"combined-open-ended"
class=
"combined-open-ended"
data-ajax-url=
"${ajax_url}"
data-allow_reset=
"${allow_reset}"
data-state=
"${state}"
>
% for item in items:
% for item in items:
<div
class=
"item"
>
${item['content'] | n}
</div>
<div
class=
"item"
>
${item['content'] | n}
</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