Cache to debug other branch
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -202,6 +202,27 @@ class CourseGradingModel:
|
||||
del descriptor.metadata['graceperiod']
|
||||
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
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user