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
e0849e8b
Commit
e0849e8b
authored
Dec 13, 2012
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache to debug other branch
parent
a39d609e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
68 deletions
+68
-68
cms/djangoapps/contentstore/views.py
+20
-0
cms/djangoapps/models/settings/course_grading.py
+21
-0
cms/static/js/models/course_relative.js
+7
-5
cms/templates/overview.html
+17
-63
cms/urls.py
+3
-0
No files found.
cms/djangoapps/contentstore/views.py
View file @
e0849e8b
...
...
@@ -167,6 +167,7 @@ def course_index(request, org, course, name):
'active_tab'
:
'courseware'
,
'context_course'
:
course
,
'sections'
:
sections
,
'course_graders'
:
json
.
dumps
(
CourseGradingModel
.
fetch
(
course
.
location
)
.
graders
),
'parent_location'
:
course
.
location
,
'new_section_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'chapter'
,
'Empty'
),
'new_subsection_template'
:
Location
(
'i4x'
,
'edx'
,
'templates'
,
'sequential'
,
'Empty'
),
# for now they are the same, but the could be different at some point...
...
...
@@ -339,6 +340,25 @@ def preview_component(request, location):
'editor'
:
wrap_xmodule
(
component
.
get_html
,
component
,
'xmodule_edit.html'
)(),
})
@expect_json
@login_required
@ensure_csrf_cookie
def
assignment_type_update
(
request
,
org
,
course
,
category
,
name
):
'''
CRUD operations on assignment types for sections and subsections and anything else gradable.
'''
location
=
Location
([
'i4x'
,
org
,
course
,
category
,
name
])
if
not
has_access
(
request
.
user
,
location
):
raise
HttpResponseForbidden
()
if
request
.
method
==
'GET'
:
# Cannot just do a get w/o knowing the course name :-(
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
get_section_grader_type
(
location
)),
mimetype
=
"application/json"
)
elif
request
.
method
==
'POST'
:
# post or put, doesn't matter.
return
HttpResponse
(
json
.
dumps
(
CourseGradingModel
.
update_section_grader_type
(
location
,
request
.
POST
)),
mimetype
=
"application/json"
)
def
user_author_string
(
user
):
'''Get an author string for commits by this user. Format:
...
...
cms/djangoapps/models/settings/course_grading.py
View file @
e0849e8b
...
...
@@ -203,6 +203,27 @@ class CourseGradingModel:
get_modulestore
(
course_location
)
.
update_metadata
(
course_location
,
descriptor
.
metadata
)
@staticmethod
def
get_section_grader_type
(
location
):
"""
"""
if
not
isinstance
(
location
,
Location
):
location
=
Location
(
location
)
# TODO impl to return {grader-type, location, id (random)}
@staticmethod
def
update_section_grader_type
(
location
,
jsondict
):
"""
"""
if
not
isinstance
(
location
,
Location
):
location
=
Location
(
location
)
# TODO impl to return {grader-type, location, id (random)}
@staticmethod
def
convert_set_grace_period
(
descriptor
):
# 5 hours 59 minutes 59 seconds => converted to iso format
rawgrace
=
descriptor
.
metadata
.
get
(
'graceperiod'
,
None
)
...
...
cms/static/js/models/course_relative.js
View file @
e0849e8b
...
...
@@ -8,11 +8,11 @@ CMS.Models.Location = Backbone.Model.extend({
},
toUrl
:
function
(
overrides
)
{
return
(
overrides
[
'tag'
]
?
overrides
[
'tag'
]
:
this
.
get
(
'tag'
))
+
"://"
+
(
overrides
[
'org'
]
?
overrides
[
'org'
]
:
this
.
get
(
'org'
))
+
"/"
+
(
overrides
[
'course'
]
?
overrides
[
'course'
]
:
this
.
get
(
'course'
))
+
"/"
+
(
overrides
[
'category'
]
?
overrides
[
'category'
]
:
this
.
get
(
'category'
))
+
"/"
+
(
overrides
[
'name'
]
?
overrides
[
'name'
]
:
this
.
get
(
'name'
))
+
"/"
;
(
overrides
&&
overrides
[
'tag'
]
?
overrides
[
'tag'
]
:
this
.
get
(
'tag'
))
+
"://"
+
(
overrides
&&
overrides
[
'org'
]
?
overrides
[
'org'
]
:
this
.
get
(
'org'
))
+
"/"
+
(
overrides
&&
overrides
[
'course'
]
?
overrides
[
'course'
]
:
this
.
get
(
'course'
))
+
"/"
+
(
overrides
&&
overrides
[
'category'
]
?
overrides
[
'category'
]
:
this
.
get
(
'category'
))
+
"/"
+
(
overrides
&&
overrides
[
'name'
]
?
overrides
[
'name'
]
:
this
.
get
(
'name'
))
+
"/"
;
},
_tagPattern
:
/
[^
:
]
+/g
,
_fieldPattern
:
new
RegExp
(
'[^/]+'
,
'g'
),
...
...
@@ -28,6 +28,7 @@ CMS.Models.Location = Backbone.Model.extend({
}
}
else
if
(
_
.
isString
(
payload
))
{
this
.
_tagPattern
.
lastIndex
=
0
;
// odd regex behavior requires this to be reset sometimes
var
foundTag
=
this
.
_tagPattern
.
exec
(
payload
);
if
(
foundTag
)
{
this
.
_fieldPattern
.
lastIndex
=
this
.
_tagPattern
.
lastIndex
+
1
;
// skip over the colon
...
...
@@ -36,6 +37,7 @@ CMS.Models.Location = Backbone.Model.extend({
org
:
this
.
_fieldPattern
.
exec
(
payload
)[
0
],
course
:
this
.
_fieldPattern
.
exec
(
payload
)[
0
],
category
:
this
.
_fieldPattern
.
exec
(
payload
)[
0
],
// FIXME handle no trailing /
name
:
this
.
_fieldPattern
.
exec
(
payload
)[
0
]
}
}
...
...
cms/templates/overview.html
View file @
e0849e8b
...
...
@@ -17,41 +17,23 @@
<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"
>
(
function
()
{
$body
=
$
(
'body'
);
$
(
'.gradable-status .menu-toggle'
).
bind
(
'click'
,
showGradeMenu
);
$
(
'.gradable-status .menu'
).
bind
(
'click'
,
selectGradeType
);
})();
function
showGradeMenu
(
e
)
{
$section
=
$
(
this
).
closest
(
'.gradable-status'
);
e
.
preventDefault
();
$section
.
toggleClass
(
'is-active'
);
}
function
selectGradeType
(
e
)
{
e
.
preventDefault
();
var
$section
=
$
(
this
).
closest
(
'.gradable-status'
);
$section
.
find
(
'.menu li a'
).
removeClass
(
'is-selected'
);
var
$target
=
$
(
e
.
target
).
addClass
(
'is-selected'
);
var
$label
=
$section
.
find
(
'.status-label'
);
$section
.
removeClass
(
'is-active'
);
$label
.
html
(
$target
.
html
());
if
(
$target
.
hasClass
(
'gradable-status-notgraded'
))
{
$section
.
removeClass
(
'is-set'
);
}
else
{
$section
.
addClass
(
'is-set'
);
}
}
$
(
document
).
ready
(
function
(){
// TODO figure out whether these should be in window or someplace else?
window
.
graderTypes
=
new
CMS
.
Models
.
Settings
.
CourseGraderCollection
();
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
({
el
:
ele
,
graders
:
window
.
graderTypes
});
});
});
</script>
</
%
block>
...
...
@@ -167,21 +149,7 @@
</div>
</div>
<div
class=
"gradable-status"
>
<h4
class=
"status-label"
>
Not Graded
</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"
>
<li><a
class=
"is-selected"
href=
"#"
>
Homework
</a></li>
<li><a
href=
"#"
>
Finger Exercises
</a></li>
<li><a
href=
"#"
>
Lab
</a></li>
<li><a
href=
"#"
>
Midterm Exam
</a></li>
<li><a
href=
"#"
>
Final Exam
</a></li>
<li><a
class=
"gradable-status-notgraded"
href=
"#"
>
Not Graded
</a></li>
</ul>
<div
class=
"gradable-status"
data-initial-status=
"${section.metadata.get('format', 'Not Graded')}"
>
</div>
<div
class=
"item-actions"
>
...
...
@@ -207,21 +175,7 @@
</a>
</div>
<div
class=
"gradable-status"
>
<h4
class=
"status-label"
>
Not Graded
</h4>
<a
data-tooltip=
"Mark/unmark this subsection as graded"
class=
"menu-toggle"
href=
"#"
>
<span
class=
"ss-icon ss-standard"
>
✓
</span>
</a>
<ul
class=
"menu"
>
<li><a
class=
"is-selected"
href=
"#"
>
Homework
</a></li>
<li><a
href=
"#"
>
Finger Exercises
</a></li>
<li><a
href=
"#"
>
Lab
</a></li>
<li><a
href=
"#"
>
Midterm Exam
</a></li>
<li><a
href=
"#"
>
Final Exam
</a></li>
<li><a
class=
"gradable-status-notgraded"
href=
"#"
>
Not Graded
</a></li>
</ul>
<div
class=
"gradable-status"
data-initial-status=
"${subsection.metadata.get('format', 'Not Graded')}"
>
</div>
<div
class=
"item-actions"
>
...
...
cms/urls.py
View file @
e0849e8b
...
...
@@ -39,6 +39,9 @@ urlpatterns = ('',
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/settings/(?P<name>[^/]+)$'
,
'contentstore.views.get_course_settings'
,
name
=
'course_settings'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/settings/(?P<name>[^/]+)/section/(?P<section>[^/]+).*$'
,
'contentstore.views.course_settings_updates'
,
name
=
'course_settings'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/grades/(?P<name>[^/]+)/(?P<grader_index>.*)$'
,
'contentstore.views.course_grader_updates'
,
name
=
'course_settings'
),
url
(
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/(?P<category>[^/]+)/(?P<name>[^/]+)/gradeas.*$'
,
'contentstore.views.assignment_type_update'
,
name
=
'assignment_type_update'
),
url
(
r'^pages/(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<coursename>[^/]+)$'
,
'contentstore.views.static_pages'
,
name
=
'static_pages'
),
url
(
r'^edit_static/(?P<org>[^/]+)/(?P<course>[^/]+)/course/(?P<coursename>[^/]+)$'
,
'contentstore.views.edit_static'
,
name
=
'edit_static'
),
...
...
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