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
6c64032f
Commit
6c64032f
authored
Dec 14, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Overview should be ready to test.
parent
e0849e8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
8 deletions
+89
-8
cms/djangoapps/models/settings/course_grading.py
+15
-8
cms/static/js/views/grader-select-view.js
+74
-0
No files found.
cms/djangoapps/models/settings/course_grading.py
View file @
6c64032f
...
@@ -204,23 +204,30 @@ class CourseGradingModel:
...
@@ -204,23 +204,30 @@ class CourseGradingModel:
@staticmethod
@staticmethod
def
get_section_grader_type
(
location
):
def
get_section_grader_type
(
location
):
"""
"""
if
not
isinstance
(
location
,
Location
):
if
not
isinstance
(
location
,
Location
):
location
=
Location
(
location
)
location
=
Location
(
location
)
# TODO impl to return {grader-type, location, id (random)}
descriptor
=
get_modulestore
(
location
)
.
get_item
(
location
)
return
{
"grader-type"
:
descriptor
.
metadata
.
get
(
'format'
,
"Not Graded"
),
"location"
:
location
,
"id"
:
99
# just an arbitrary value to
}
@staticmethod
@staticmethod
def
update_section_grader_type
(
location
,
jsondict
):
def
update_section_grader_type
(
location
,
jsondict
):
"""
"""
if
not
isinstance
(
location
,
Location
):
if
not
isinstance
(
location
,
Location
):
location
=
Location
(
location
)
location
=
Location
(
location
)
descriptor
=
get_modulestore
(
location
)
.
get_item
(
location
)
if
'grader-type'
in
jsondict
:
descriptor
.
metadata
[
'format'
]
=
jsondict
.
get
(
'grader-type'
)
descriptor
.
metadata
[
'graded'
]
=
True
else
:
del
descriptor
.
metadata
[
'format'
]
descriptor
.
metadata
[
'graded'
]
=
False
# TODO impl to return {grader-type, location, id (random)}
get_modulestore
(
location
)
.
update_metadata
(
location
,
descriptor
.
metadata
)
@staticmethod
@staticmethod
...
...
cms/static/js/views/grader-select-view.js
0 → 100644
View file @
6c64032f
CMS
.
Models
.
AssignmentGrade
=
Backbone
.
Model
.
extend
({
idAttribute
:
"cid"
,
// not sure if this is kosher
defaults
:
{
grader
-
type
:
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-url'
])
{
this
.
set
(
'location'
)
=
new
CMS
.
Models
.
Location
(
attrs
[
'assignment-url'
],
{
parse
:
true
});
}
},
parse
:
function
(
attrs
)
{
if
(
attrs
[
'location'
])
{
attrs
.
location
=
new
CMS
.
Models
.
Location
(
attrs
[
'location'
],
{
parse
:
true
});
}
}
urlRoot
:
function
()
{
if
(
this
.
has
(
'location'
))
{
var
location
=
this
.
get
(
'location'
);
return
'/'
+
location
.
get
(
'org'
)
+
"/"
+
location
.
get
(
'course'
)
+
'/'
+
location
.
get
(
'category'
)
+
'/'
+
location
.
get
(
'name'
)
+
'/gradeas/'
;
}
else
return
""
;
}
});
CMS
.
Views
.
OverviewAssignmentGrader
=
Backbone
.
View
.
extend
({
// instantiate w/ { graders : CourseGraderCollection, el : <the gradable-status div> }
events
:
{
"click .menu-toggle"
:
"showGradeMenu"
,
"click .menu"
:
"selectGradeType"
},
initialize
:
function
()
{
// call template w/ {assignment-type : formatname, graders : CourseGraderCollection instance }
this
.
template
=
_
.
template
(
'<h4 class="status-label"><%= assignment-type %></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-type) {%>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'
)});
this
.
render
();
},
render
:
function
()
{
this
.
$el
.
html
(
this
.
template
({
assignment
-
type
:
this
.
assignmentGrade
.
get
(
'grader-type'
),
graders
:
this
.
graders
}));
if
(
this
.
assignmentGrade
.
has
(
'grader-type'
)
&&
assignmentGrade
.
get
(
'grader-type'
)
!=
"Not Graded"
)
{
this
.
$el
.
addClass
(
'is-set'
);
}
else
{
this
.
$el
.
removeClass
(
'is-set'
);
}
},
showGradeMenu
:
function
(
e
)
{
e
.
preventDefault
();
this
.
$el
.
toggleClass
(
'is-active'
);
},
selectGradeType
:
function
(
e
)
{
e
.
preventDefault
();
// 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
.
render
();
}
})
\ No newline at end of file
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