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
7c768cbb
Commit
7c768cbb
authored
Dec 06, 2012
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wire up the separate action button
parent
aee1e5e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
25 deletions
+27
-25
lms/static/coffee/src/staff_grading/staff_grading.coffee
+27
-25
No files found.
lms/static/coffee/src/staff_grading/staff_grading.coffee
View file @
7c768cbb
...
@@ -26,7 +26,7 @@ class StaffGradingBackend
...
@@ -26,7 +26,7 @@ class StaffGradingBackend
response
=
response
=
success
:
true
success
:
true
problem_name
:
'Problem 1'
problem_name
:
'Problem 1'
num_
left
:
3
num_
graded
:
3
num_total
:
5
num_total
:
5
prompt
:
'''
prompt
:
'''
<h2>S11E3: Metal Bands</h2>
<h2>S11E3: Metal Bands</h2>
...
@@ -56,7 +56,7 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
...
@@ -56,7 +56,7 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
response
=
response
=
success
:
true
success
:
true
problem_name
:
'Problem 2'
problem_name
:
'Problem 2'
num_
left
:
2
num_
graded
:
2
num_total
:
5
num_total
:
5
prompt
:
'This is a fake second problem'
prompt
:
'This is a fake second problem'
submission
:
'This is the best submission ever! '
+
@
mock_cnt
submission
:
'This is the best submission ever! '
+
@
mock_cnt
...
@@ -75,16 +75,16 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
...
@@ -75,16 +75,16 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
@
mock
(
'get_next'
,
{
location
:
data
.
location
})
@
mock
(
'get_next'
,
{
location
:
data
.
location
})
# get_problem_list
# get_problem_list
# sends in a course_id and a grader_id
# sends in a course_id and a grader_id
# should get back a list of problem_ids, problem_names, num_
left
, num_total
# should get back a list of problem_ids, problem_names, num_
graded
, num_total
else
if
cmd
==
'get_problem_list'
else
if
cmd
==
'get_problem_list'
@
mock_cnt
=
1
@
mock_cnt
=
1
response
=
response
=
success
:
true
success
:
true
problem_list
:
[
problem_list
:
[
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo1'
,
\
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo1'
,
\
problem_name
:
"Problem 1"
,
num_
left
:
3
,
num_total
:
5
},
problem_name
:
"Problem 1"
,
num_
graded
:
3
,
num_total
:
5
},
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo2'
,
\
{
location
:
'i4x://MITx/3.091x/problem/open_ended_demo2'
,
\
problem_name
:
"Problem 2"
,
num_
left
:
1
,
num_total
:
5
}
problem_name
:
"Problem 2"
,
num_
graded
:
1
,
num_total
:
5
}
]
]
else
else
response
=
response
=
...
@@ -97,7 +97,7 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
...
@@ -97,7 +97,7 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
message
:
'No more submissions'
message
:
'No more submissions'
if
@
mock_cnt
%
7
==
0
if
@
mock_cnt
%
3
==
0
response
=
response
=
success
:
false
success
:
false
error
:
'An error for testing'
error
:
'An error for testing'
...
@@ -139,6 +139,7 @@ class StaffGrading
...
@@ -139,6 +139,7 @@ class StaffGrading
@
feedback_area
=
$
(
'.feedback-area'
)
@
feedback_area
=
$
(
'.feedback-area'
)
@
score_selection_container
=
$
(
'.score-selection-container'
)
@
score_selection_container
=
$
(
'.score-selection-container'
)
@
submit_button
=
$
(
'.submit-button'
)
@
submit_button
=
$
(
'.submit-button'
)
@
action_button
=
$
(
'.action-button'
)
@
ml_error_info_container
=
$
(
'.ml-error-info-container'
)
@
ml_error_info_container
=
$
(
'.ml-error-info-container'
)
@
breadcrumbs
=
$
(
'.breadcrumbs'
)
@
breadcrumbs
=
$
(
'.breadcrumbs'
)
...
@@ -156,16 +157,15 @@ class StaffGrading
...
@@ -156,16 +157,15 @@ class StaffGrading
@
location
=
''
@
location
=
''
@
prompt_name
=
''
@
prompt_name
=
''
@
num_total
=
0
@
num_total
=
0
@
num_
left
=
0
@
num_
graded
=
0
@
score
=
null
@
score
=
null
@
problems
=
null
@
problems
=
null
# action handlers
# action handlers
@
submit_button
.
click
@
submit
@
submit_button
.
click
@
submit
# TODO: fix this to do something more intelligent
# render intial state
@
action_button
.
click
@
submit
#@render_view()
# send initial request automatically
# send initial request automatically
@
get_problem_list
()
@
get_problem_list
()
...
@@ -190,7 +190,7 @@ class StaffGrading
...
@@ -190,7 +190,7 @@ class StaffGrading
set_button_text
:
(
text
)
=>
set_button_text
:
(
text
)
=>
@
submit
_button
.
attr
(
'value'
,
text
)
@
action
_button
.
attr
(
'value'
,
text
)
graded_callback
:
(
event
)
=>
graded_callback
:
(
event
)
=>
@
score
=
event
.
target
.
value
@
score
=
event
.
target
.
value
...
@@ -207,7 +207,7 @@ class StaffGrading
...
@@ -207,7 +207,7 @@ class StaffGrading
if
response
.
problem_list
if
response
.
problem_list
@
problems
=
response
.
problem_list
@
problems
=
response
.
problem_list
else
if
response
.
submission
else
if
response
.
submission
@
data_loaded
(
response
.
prompt
,
response
.
submission
,
response
.
rubric
,
response
.
submission_id
,
response
.
max_score
,
response
.
ml_error_info
,
response
.
problem_name
,
response
.
num_
left
,
response
.
num_total
)
@
data_loaded
(
response
.
prompt
,
response
.
submission
,
response
.
rubric
,
response
.
submission_id
,
response
.
max_score
,
response
.
ml_error_info
,
response
.
problem_name
,
response
.
num_
graded
,
response
.
num_total
)
else
else
@
no_more
(
response
.
message
)
@
no_more
(
response
.
message
)
else
else
...
@@ -237,7 +237,7 @@ class StaffGrading
...
@@ -237,7 +237,7 @@ class StaffGrading
@
error_msg
=
msg
@
error_msg
=
msg
@
state
=
state_error
@
state
=
state_error
data_loaded
:
(
prompt
,
submission
,
rubric
,
submission_id
,
max_score
,
ml_error_info
,
prompt_name
,
num_
left
,
num_total
)
->
data_loaded
:
(
prompt
,
submission
,
rubric
,
submission_id
,
max_score
,
ml_error_info
,
prompt_name
,
num_
graded
,
num_total
)
->
@
prompt
=
prompt
@
prompt
=
prompt
@
submission
=
submission
@
submission
=
submission
@
rubric
=
rubric
@
rubric
=
rubric
...
@@ -247,7 +247,7 @@ class StaffGrading
...
@@ -247,7 +247,7 @@ class StaffGrading
@
score
=
null
@
score
=
null
@
ml_error_info
=
ml_error_info
@
ml_error_info
=
ml_error_info
@
prompt_name
=
prompt_name
@
prompt_name
=
prompt_name
@
num_
left
=
num_left
@
num_
graded
=
num_graded
@
num_total
=
num_total
@
num_total
=
num_total
@
state
=
state_grading
@
state
=
state_grading
if
not
@
max_score
?
if
not
@
max_score
?
...
@@ -256,7 +256,7 @@ class StaffGrading
...
@@ -256,7 +256,7 @@ class StaffGrading
no_more
:
(
message
)
->
no_more
:
(
message
)
->
@
prompt
=
null
@
prompt
=
null
@
prompt_name
=
''
@
prompt_name
=
''
@
num_
left
=
0
@
num_
graded
=
0
@
num_total
=
0
@
num_total
=
0
@
submission
=
null
@
submission
=
null
@
rubric
=
null
@
rubric
=
null
...
@@ -267,11 +267,6 @@ class StaffGrading
...
@@ -267,11 +267,6 @@ class StaffGrading
@
max_score
=
0
@
max_score
=
0
@
state
=
state_no_data
@
state
=
state_no_data
hide_if_empty
:
(
container
,
message
)
->
if
message
==
''
container
.
hide
()
else
container
.
html
(
message
)
render_view
:
()
->
render_view
:
()
->
# clear the problem list and breadcrumbs
# clear the problem list and breadcrumbs
...
@@ -280,8 +275,10 @@ class StaffGrading
...
@@ -280,8 +275,10 @@ class StaffGrading
@
problem_list_container
.
toggle
(
@
list_view
)
@
problem_list_container
.
toggle
(
@
list_view
)
if
@
backend
.
mock_backend
if
@
backend
.
mock_backend
@
message
=
@
message
+
"<p>NOTE: Mocking backend.</p>"
@
message
=
@
message
+
"<p>NOTE: Mocking backend.</p>"
@
hide_if_empty
(
@
message_container
,
@
message
)
@
message_container
.
html
(
@
message
)
@
hide_if_empty
(
@
error_container
,
@
error_msg
)
@
error_container
.
html
(
@
error_msg
)
@
message_container
.
toggle
(
@
message
!=
""
)
@
error_container
.
toggle
(
@
error_msg
!=
""
)
# only show the grading elements when we are not in list view or the state
# only show the grading elements when we are not in list view or the state
...
@@ -293,7 +290,7 @@ class StaffGrading
...
@@ -293,7 +290,7 @@ class StaffGrading
@
rubric_wrapper
.
toggle
(
show_grading_elements
)
@
rubric_wrapper
.
toggle
(
show_grading_elements
)
@
grading_wrapper
.
toggle
(
show_grading_elements
)
@
grading_wrapper
.
toggle
(
show_grading_elements
)
@
ml_error_info_container
.
toggle
(
show_grading_elements
)
@
ml_error_info_container
.
toggle
(
show_grading_elements
)
@
submit
_button
.
hide
()
@
action
_button
.
hide
()
if
@
list_view
if
@
list_view
@
render_list
()
@
render_list
()
...
@@ -302,7 +299,7 @@ class StaffGrading
...
@@ -302,7 +299,7 @@ class StaffGrading
problem_link
:
(
problem
)
->
problem_link
:
(
problem
)
->
link
=
$
(
'<a>'
).
attr
(
'href'
,
"javascript:void(0)"
).
append
(
link
=
$
(
'<a>'
).
attr
(
'href'
,
"javascript:void(0)"
).
append
(
"
#{
problem
.
problem_name
}
(
#{
problem
.
num_
left
}
left
out of
#{
problem
.
num_total
}
)"
)
"
#{
problem
.
problem_name
}
(
#{
problem
.
num_
graded
}
graded
out of
#{
problem
.
num_total
}
)"
)
.
click
=>
.
click
=>
@
get_next_submission
problem
.
location
@
get_next_submission
problem
.
location
...
@@ -320,6 +317,7 @@ class StaffGrading
...
@@ -320,6 +317,7 @@ class StaffGrading
render_problem
:
()
->
render_problem
:
()
->
# make the view elements match the state. Idempotent.
# make the view elements match the state. Idempotent.
show_submit_button
=
true
show_submit_button
=
true
show_action_button
=
true
problem_list_link
=
$
(
'<a>'
).
attr
(
'href'
,
'javascript:void(0);'
)
problem_list_link
=
$
(
'<a>'
).
attr
(
'href'
,
'javascript:void(0);'
)
.
append
(
"< Back to problem list"
)
.
append
(
"< Back to problem list"
)
...
@@ -331,21 +329,24 @@ class StaffGrading
...
@@ -331,21 +329,24 @@ class StaffGrading
if
@
state
==
state_error
if
@
state
==
state_error
@
set_button_text
(
'Try loading again'
)
@
set_button_text
(
'Try loading again'
)
show_action_button
=
true
else
if
@
state
==
state_grading
else
if
@
state
==
state_grading
@
ml_error_info_container
.
html
(
@
ml_error_info
)
@
ml_error_info_container
.
html
(
@
ml_error_info
)
@
prompt_container
.
html
(
@
prompt
)
@
prompt_container
.
html
(
@
prompt
)
@
prompt_name_container
.
html
(
"
#{
@
prompt_name
}
<span class='sub-heading'>(
#{
@
num_
left
}
left
out of
#{
@
num_total
}
)</span>"
)
@
prompt_name_container
.
html
(
"
#{
@
prompt_name
}
<span class='sub-heading'>(
#{
@
num_
graded
}
completed
out of
#{
@
num_total
}
)</span>"
)
@
submission_container
.
html
(
@
make_paragraphs
(
@
submission
))
@
submission_container
.
html
(
@
make_paragraphs
(
@
submission
))
@
rubric_container
.
html
(
@
rubric
)
@
rubric_container
.
html
(
@
rubric
)
# no submit button until user picks grade.
# no submit button until user picks grade.
show_submit_button
=
false
show_submit_button
=
false
show_action_button
=
false
@
setup_score_selection
()
@
setup_score_selection
()
else
if
@
state
==
state_graded
else
if
@
state
==
state_graded
@
set_button_text
(
'Submit'
)
@
set_button_text
(
'Submit'
)
show_action_button
=
false
else
if
@
state
==
state_no_data
else
if
@
state
==
state_no_data
@
message_container
.
html
(
@
message
)
@
message_container
.
html
(
@
message
)
...
@@ -355,6 +356,7 @@ class StaffGrading
...
@@ -355,6 +356,7 @@ class StaffGrading
@
error
(
'System got into invalid state '
+
@
state
)
@
error
(
'System got into invalid state '
+
@
state
)
@
submit_button
.
toggle
(
show_submit_button
)
@
submit_button
.
toggle
(
show_submit_button
)
@
action_button
.
toggle
(
show_action_button
)
submit
:
(
event
)
=>
submit
:
(
event
)
=>
event
.
preventDefault
()
event
.
preventDefault
()
...
...
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