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
58364384
Commit
58364384
authored
Nov 15, 2012
by
Victor Shnayder
Committed by
Victor Shnayder
Nov 30, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hook up radio buttons, hide submit button till after grading
parent
e910f60e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
10 deletions
+30
-10
lms/static/coffee/src/staff_grading/staff_grading.coffee
+27
-7
lms/static/coffee/src/staff_grading/test_grading.html
+3
-3
No files found.
lms/static/coffee/src/staff_grading/staff_grading.coffee
View file @
58364384
...
@@ -4,7 +4,8 @@ get_random_int: (min, max) ->
...
@@ -4,7 +4,8 @@ get_random_int: (min, max) ->
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
))
+
min
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
))
+
min
# states
# states
state_grading
=
"have_data"
state_grading
=
"grading"
state_graded
=
"graded"
state_no_data
=
"no_data"
state_no_data
=
"no_data"
state_error
=
"error"
state_error
=
"error"
...
@@ -82,8 +83,10 @@ class StaffGrading
...
@@ -82,8 +83,10 @@ class StaffGrading
# action handlers
# action handlers
@
submit_button
.
click
@
submit
@
submit_button
.
click
@
submit
@
correct_button
.
click
()
=>
@
score
=
1
# TODO: hook up an event to the input changing, which updates
@
incorrect_button
.
click
()
=>
@
score
=
0
# @score (instead of the individual hacks)
$
(
'#correct-radio'
).
click
@
graded_callback
$
(
'#incorrect-radio'
).
click
@
graded_callback
# render intial state
# render intial state
@
render_view
()
@
render_view
()
...
@@ -92,8 +95,13 @@ class StaffGrading
...
@@ -92,8 +95,13 @@ class StaffGrading
@
get_next_submission
()
@
get_next_submission
()
set_button_text
:
(
text
)
->
set_button_text
:
(
text
)
=>
@
submit_button
.
prop
(
'value'
,
text
)
@
submit_button
.
attr
(
'value'
,
text
)
graded_callback
:
(
event
)
=>
@
score
=
event
.
target
.
value
@
state
=
state_graded
@
render_view
()
ajax_callback
:
(
response
)
=>
ajax_callback
:
(
response
)
=>
# always clear out errors and messages on transition.
# always clear out errors and messages on transition.
...
@@ -138,6 +146,7 @@ class StaffGrading
...
@@ -138,6 +146,7 @@ class StaffGrading
render_view
:
()
->
render_view
:
()
->
# make the view elements match the state. Idempotent.
# make the view elements match the state. Idempotent.
show_grading_elements
=
false
show_grading_elements
=
false
show_submit_button
=
true
@
message_container
.
html
(
@
message
)
@
message_container
.
html
(
@
message
)
@
error_container
.
html
(
@
error_msg
)
@
error_container
.
html
(
@
error_msg
)
...
@@ -149,6 +158,16 @@ class StaffGrading
...
@@ -149,6 +158,16 @@ class StaffGrading
@
submission_container
.
html
(
@
submission
)
@
submission_container
.
html
(
@
submission
)
@
rubric_container
.
html
(
@
rubric
)
@
rubric_container
.
html
(
@
rubric
)
show_grading_elements
=
true
show_grading_elements
=
true
# no submit button until user picks grade.
show_submit_button
=
false
# TODO: clean up with proper input-related logic
$
(
'#correct-radio'
)[
0
].
checked
=
false
$
(
'#incorrect-radio'
)[
0
].
checked
=
false
else
if
@
state
==
state_graded
show_grading_elements
=
true
@
set_button_text
(
'Submit'
)
@
set_button_text
(
'Submit'
)
else
if
@
state
==
state_no_data
else
if
@
state
==
state_no_data
...
@@ -158,6 +177,7 @@ class StaffGrading
...
@@ -158,6 +177,7 @@ class StaffGrading
else
else
@
error
(
'System got into invalid state '
+
@
state
)
@
error
(
'System got into invalid state '
+
@
state
)
@
submit_button
.
toggle
(
show_submit_button
)
@
submission_wrapper
.
toggle
(
show_grading_elements
)
@
submission_wrapper
.
toggle
(
show_grading_elements
)
@
rubric_wrapper
.
toggle
(
show_grading_elements
)
@
rubric_wrapper
.
toggle
(
show_grading_elements
)
...
@@ -167,12 +187,12 @@ class StaffGrading
...
@@ -167,12 +187,12 @@ class StaffGrading
if
@
state
==
state_error
if
@
state
==
state_error
@
get_next_submission
()
@
get_next_submission
()
else
if
@
state
==
state_grad
ing
else
if
@
state
==
state_grad
ed
@
submit_and_get_next
()
@
submit_and_get_next
()
else
if
@
state
==
state_no_data
else
if
@
state
==
state_no_data
@
get_next_submission
()
@
get_next_submission
()
else
else
@
error
(
'System got into invalid state '
+
@
state
)
@
error
(
'System got into invalid state
for submission:
'
+
@
state
)
# for now, just create an instance and load it...
# for now, just create an instance and load it...
...
...
lms/static/coffee/src/staff_grading/test_grading.html
View file @
58364384
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<html>
<head>
<title></title>
<title></title>
<script
src=
"http://code.jquery.com/jquery-latest.js"
></script>
<!-- <script src="http://code.jquery.com/jquery-latest.js"></script> -->
<script
src=
"../../../admin/js/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"staff_grading.js"
></script>
<script
type=
"text/javascript"
src=
"staff_grading.js"
></script>
</head>
</head>
...
@@ -32,8 +33,7 @@
...
@@ -32,8 +33,7 @@
<p>
<p>
<label
for=
"correct-radio"
>
Correct
</label>
<label
for=
"correct-radio"
>
Correct
</label>
<input
type=
"radio"
name=
"score-selection"
id=
"correct-radio"
value=
"1"
>
<input
type=
"radio"
name=
"score-selection"
id=
"correct-radio"
value=
"1"
>
<label
for=
"incorrect-radio"
>
Incorrect
</label>
<label
for=
"correct-radio"
>
Incorrect
</label>
<input
type=
"radio"
name=
"score-selection"
id=
"incorrect-radio"
value=
"0"
>
<input
type=
"radio"
name=
"score-selection"
id=
"incorrect-radio"
value=
"0"
>
</p>
</p>
</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