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
56637347
Commit
56637347
authored
Nov 01, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
working on js
parent
54687d45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
17 deletions
+40
-17
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
+28
-8
common/lib/xmodule/xmodule/self_assessment_module.py
+12
-9
No files found.
common/lib/xmodule/xmodule/js/src/selfassessment/display.coffee
View file @
56637347
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#show'
,
(
->
root
=
location
.
protocol
+
"//"
+
location
.
host
post_url
=
$
(
'section.sa-wrapper input#show'
).
attr
(
'url'
)
alert
(
post_url
)
final_url
=
"/courses/MITx/6.002x/2012_Fall/modx/
#{
post_url
}
/sa_show"
alert
(
final_url
)
#@$('section.action input.check').click @check
$
(
'input#show'
).
click
(
@
show
)
#$('#save').click(function -> alert('save'))
$
.
post
final_url
,
answer
,
(
response
)
->
if
response
.
success
$
(
'p.rubric'
).
replace
(
response
.
rubric
)
alert
(
"save"
)
));
$
(
document
).
on
(
'click'
,
'section.sa-wrapper input#save'
,
(
->
answer
=
$
(
'section.sa-wrapper input#answer'
).
val
()
alert
(
answer
)
assessment
=
0
assessment_correct
=
$
(
'section.sa-wrapper input#assessment_correct'
).
val
()
alert
(
assessment_correct
)
assessment_incorrect
=
$
(
'section.sa-wrapper input#assessment_incorrect'
).
val
()
alert
(
assessment_incorrect
)
$
(
document
).
on
(
'click'
,
'input#save'
,
(
->
answer
=
$
(
'#answer'
).
text
()
$
.
postWithPrefix
"modx/6.002x/sa_save"
,
answer
,
(
response
)
->
root
=
location
.
protocol
+
"//"
+
location
.
host
post_url
=
$
(
'section.sa-wrapper input#show'
).
attr
(
'url'
)
alert
(
post_url
)
final_url
=
"/courses/MITx/6.002x/2012_Fall/modx/
#{
post_url
}
/sa_save"
alert
(
final_url
)
$
.
post
final_url
,
answer
,
(
response
)
->
if
response
.
success
$
(
'p.rubric'
).
replace
(
response
.
rubric
)
...
...
@@ -21,5 +43,3 @@ show: =>
save
:
=>
alert
(
"save"
)
alert
(
$
(
'input#save'
).
attr
(
'url'
))
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
56637347
...
...
@@ -19,9 +19,9 @@ from xmodule.contentstore.content import XASSET_SRCREF_PREFIX, StaticContent
log
=
logging
.
getLogger
(
"mitx.courseware"
)
rubric_form
=
(
'<section class="sa-wrapper"
sa_id="two"><input type="radio" name="assessmen
t" value="correct"/>Correct<br/>'
'<input type="radio" name="assessment" value="incorrect">'
'Incorrect<br/><input type="button" value="Save" id="s
how" name="show
"/></section>'
)
rubric_form
=
(
'<section class="sa-wrapper"
><input type="radio" name="assessment" id="assessment_correc
t" value="correct"/>Correct<br/>'
'<input type="radio"
id="assessment_incorrect"
name="assessment" value="incorrect">'
'Incorrect<br/><input type="button" value="Save" id="s
ave" name="save
"/></section>'
)
def
only_one
(
lst
,
default
=
""
,
process
=
lambda
x
:
x
):
"""
...
...
@@ -58,9 +58,9 @@ class SelfAssessmentModule(XModule):
self
.
rubric
=
''
.
join
([
etree
.
tostring
(
child
)
for
child
in
only_one
(
dom2
.
xpath
(
'rubric'
))])
self
.
problem
=
''
.
join
([
etree
.
tostring
(
child
)
for
child
in
only_one
(
dom2
.
xpath
(
'problem'
))])
problem_form
=
(
'<section class="sa-wrapper"
sa_id="one"
><input type="text" name="answer" '
problem_form
=
(
'<section class="sa-wrapper"><input type="text" name="answer" '
'id="answer"/><br/>'
'<input type="button" value="Check" id ="s
ave" name="save
" url="{0}"/>'
'<input type="button" value="Check" id ="s
how" name="show
" url="{0}"/>'
'<p id="rubric"></p></section>'
)
.
format
(
self
.
location
)
self
.
problem
=
''
.
join
([
self
.
problem
,
problem_form
])
...
...
@@ -87,7 +87,6 @@ class SelfAssessmentModule(XModule):
'''
handlers
=
{
'sa_get'
:
self
.
show_problem
,
'sa_show'
:
self
.
show_rubric
,
'sa_save'
:
self
.
save_problem
,
}
...
...
@@ -104,6 +103,12 @@ class SelfAssessmentModule(XModule):
})
return
json
.
dumps
(
d
,
cls
=
ComplexEncoder
)
def
show_rubric
:
return
{
'success'
:
True
}
def
save_problem
(
self
,
get
):
'''
Save the passed in answers.
...
...
@@ -129,7 +134,7 @@ class SelfAssessmentModule(XModule):
self
.
system
.
track_function
(
'save_problem_succeed'
,
event_info
)
return
{
'success'
:
True
,
'rubric'
:
self
.
rubric
}
return
{
'success'
:
True
}
class
SelfAssessmentDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
...
...
@@ -144,8 +149,6 @@ class SelfAssessmentDescriptor(XmlDescriptor, EditingDescriptor):
has_score
=
True
template_dir_name
=
"html"
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/html/edit.coffee'
)]}
js_module_name
=
"HTMLEditingDescriptor"
...
...
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