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
0fc16dff
Commit
0fc16dff
authored
Dec 14, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gradable impl'd for overview page
parent
6c64032f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
24 deletions
+32
-24
cms/djangoapps/models/settings/course_grading.py
+6
-6
cms/static/js/views/grader-select-view.js
+20
-15
cms/templates/overview.html
+6
-3
No files found.
cms/djangoapps/models/settings/course_grading.py
View file @
0fc16dff
...
...
@@ -199,7 +199,7 @@ class CourseGradingModel:
course_location
=
Location
(
course_location
)
descriptor
=
get_modulestore
(
course_location
)
.
get_item
(
course_location
)
del
descriptor
.
metadata
[
'graceperiod'
]
if
'graceperiod'
in
descriptor
.
metadata
:
del
descriptor
.
metadata
[
'graceperiod'
]
get_modulestore
(
course_location
)
.
update_metadata
(
course_location
,
descriptor
.
metadata
)
@staticmethod
...
...
@@ -209,7 +209,7 @@ class CourseGradingModel:
descriptor
=
get_modulestore
(
location
)
.
get_item
(
location
)
return
{
"grader
-type"
:
descriptor
.
metadata
.
get
(
'format'
,
"Not Graded"
),
"grader
Type"
:
descriptor
.
metadata
.
get
(
'format'
,
u
"Not Graded"
),
"location"
:
location
,
"id"
:
99
# just an arbitrary value to
}
...
...
@@ -220,12 +220,12 @@ class CourseGradingModel:
location
=
Location
(
location
)
descriptor
=
get_modulestore
(
location
)
.
get_item
(
location
)
if
'grader
-type'
in
jsondict
:
descriptor
.
metadata
[
'format'
]
=
jsondict
.
get
(
'grader
-t
ype'
)
if
'grader
Type'
in
jsondict
and
jsondict
[
'graderType'
]
!=
u"Not Graded"
:
descriptor
.
metadata
[
'format'
]
=
jsondict
.
get
(
'grader
T
ype'
)
descriptor
.
metadata
[
'graded'
]
=
True
else
:
del
descriptor
.
metadata
[
'format'
]
descriptor
.
metadata
[
'graded'
]
=
False
if
'format'
in
descriptor
.
metadata
:
del
descriptor
.
metadata
[
'format'
]
if
'graded'
in
descriptor
.
metadata
:
del
descriptor
.
metadata
[
'graded'
]
get_modulestore
(
location
)
.
update_metadata
(
location
,
descriptor
.
metadata
)
...
...
cms/static/js/views/grader-select-view.js
View file @
0fc16dff
CMS
.
Models
.
AssignmentGrade
=
Backbone
.
Model
.
extend
({
idAttribute
:
"cid"
,
// not sure if this is kosher
defaults
:
{
grader
-
t
ype
:
null
,
// the type label (string). May be "Not Graded" which implies None. I'd like to use id but that's ephemeral
grader
T
ype
:
null
,
// the type label (string). May be "Not Graded" which implies None. I'd like to use id but that's ephemeral
location
:
null
// A location object
},
initialize
:
function
(
attrs
)
{
if
(
attrs
[
'assignment
-u
rl'
])
{
this
.
set
(
'location'
)
=
new
CMS
.
Models
.
Location
(
attrs
[
'assignment-url'
],
{
parse
:
true
}
);
if
(
attrs
[
'assignment
U
rl'
])
{
this
.
set
(
'location'
,
new
CMS
.
Models
.
Location
(
attrs
[
'assignmentUrl'
],
{
parse
:
true
})
);
}
},
parse
:
function
(
attrs
)
{
if
(
attrs
[
'location'
])
{
if
(
attrs
&&
attrs
[
'location'
])
{
attrs
.
location
=
new
CMS
.
Models
.
Location
(
attrs
[
'location'
],
{
parse
:
true
});
}
}
}
,
urlRoot
:
function
()
{
if
(
this
.
has
(
'location'
))
{
var
location
=
this
.
get
(
'location'
);
...
...
@@ -31,26 +31,29 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
"click .menu"
:
"selectGradeType"
},
initialize
:
function
()
{
// call template w/ {assignment
-t
ype : formatname, graders : CourseGraderCollection instance }
// call template w/ {assignment
T
ype : formatname, graders : CourseGraderCollection instance }
this
.
template
=
_
.
template
(
'<h4 class="status-label"><%= assignment-type %></h4>'
+
// TODO move to a template file
'<h4 class="status-label"><%= assignmentType %></h4>'
+
'<a data-tooltip="Mark/unmark this section as graded" class="menu-toggle" href="#">'
+
'<span class="ss-icon ss-standard">✓</span>'
+
'</a>'
+
'<ul class="menu">'
+
'<% graders.each(function(option) { %>'
+
'<li><a <% if (option.get("type") == assignment
-t
ype) {%>class="is-selected" <%}%> href="#"><%= option.get("type") %></a></li>'
+
'<% }) %>'
'<li><a class="gradable-status-notgraded" href="#">Not Graded</a></li>'
'<li><a <% if (option.get("type") == assignment
T
ype) {%>class="is-selected" <%}%> href="#"><%= option.get("type") %></a></li>'
+
'<% }) %>'
+
'<li><a class="gradable-status-notgraded" href="#">Not Graded</a></li>'
+
'</ul>'
);
this
.
assignmentGrade
=
new
CMS
.
Models
.
AssignmentGrade
({
assignment
-
url
:
this
.
$el
.
closest
(
'section.branch'
).
data
(
'id'
),
grader
-
type
:
this
.
$el
.
data
(
'initial-status'
)});
assignmentUrl
:
this
.
$el
.
closest
(
'.branch'
).
data
(
'id'
),
graderType
:
this
.
$el
.
data
(
'initial-status'
)});
// TODO throw exception if graders is null
this
.
graders
=
this
.
options
[
'graders'
];
this
.
render
();
},
render
:
function
()
{
this
.
$el
.
html
(
this
.
template
({
assignment
-
type
:
this
.
assignmentGrade
.
get
(
'grader-t
ype'
),
graders
:
this
.
graders
}));
if
(
this
.
assignmentGrade
.
has
(
'grader
-type'
)
&&
assignmentGrade
.
get
(
'grader-t
ype'
)
!=
"Not Graded"
)
{
this
.
$el
.
html
(
this
.
template
({
assignment
Type
:
this
.
assignmentGrade
.
get
(
'graderT
ype'
),
graders
:
this
.
graders
}));
if
(
this
.
assignmentGrade
.
has
(
'grader
Type'
)
&&
this
.
assignmentGrade
.
get
(
'graderT
ype'
)
!=
"Not Graded"
)
{
this
.
$el
.
addClass
(
'is-set'
);
}
else
{
...
...
@@ -63,10 +66,12 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
},
selectGradeType
:
function
(
e
)
{
e
.
preventDefault
();
this
.
$el
.
toggleClass
(
'is-active'
);
// TODO I'm not happy with this string fetch via the html for what should be an id. I'd rather use the id attr
// of the CourseGradingPolicy model or null for Not Graded (NOTE, change template's if check for is-selected accordingly)
this
.
assignmentGrade
.
save
(
'grader
-type'
,
$
(
e
.
target
).
html
());
this
.
assignmentGrade
.
save
(
'grader
Type'
,
$
(
e
.
target
).
text
());
this
.
render
();
}
...
...
cms/templates/overview.html
View file @
0fc16dff
...
...
@@ -16,15 +16,18 @@
<script
src=
"${static.url('js/vendor/timepicker/jquery.timepicker.js')}"
></script>
<script
src=
"${static.url('js/vendor/timepicker/datepair.js')}"
></script>
<script
src=
"${static.url('js/vendor/date.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/models/settings/course_grading_policy.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/models/course_relative.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/views/grader-select-view.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/models/settings/course_grading_policy.js')}"
></script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
// TODO figure out whether these should be in window or someplace else?
// TODO figure out whether these should be in window or someplace else or whether they're only needed as local vars
// I believe that current (New Section/New Subsection) cause full page reloads which means these aren't needed globally
// but we really should change that behavior.
window
.
graderTypes
=
new
CMS
.
Models
.
Settings
.
CourseGraderCollection
();
window
.
graderTypes
.
course_location
=
new
CMS
.
Models
.
Location
(
'${parent_location}'
);
window
.
graderTypes
.
reset
(
$
{
course_graders
|
n
});
window
.
graderTypes
.
course_location
(
new
CMS
.
Models
.
Location
(
'${parent_location}'
));
$
(
".gradable-status"
).
each
(
function
(
index
,
ele
)
{
var
gradeView
=
new
CMS
.
Views
.
OverviewAssignmentGrader
({
...
...
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