Commit ac7b0334 by Don Mitchell

Code review changes.

parent 0b762fa3
...@@ -352,7 +352,6 @@ def assignment_type_update(request, org, course, category, name): ...@@ -352,7 +352,6 @@ def assignment_type_update(request, org, course, category, name):
raise HttpResponseForbidden() raise HttpResponseForbidden()
if request.method == 'GET': 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)), return HttpResponse(json.dumps(CourseGradingModel.get_section_grader_type(location)),
mimetype="application/json") mimetype="application/json")
elif request.method == 'POST': # post or put, doesn't matter. elif request.method == 'POST': # post or put, doesn't matter.
......
...@@ -37,7 +37,6 @@ CMS.Models.Location = Backbone.Model.extend({ ...@@ -37,7 +37,6 @@ CMS.Models.Location = Backbone.Model.extend({
org: this._fieldPattern.exec(payload)[0], org: this._fieldPattern.exec(payload)[0],
course: this._fieldPattern.exec(payload)[0], course: this._fieldPattern.exec(payload)[0],
category: this._fieldPattern.exec(payload)[0], category: this._fieldPattern.exec(payload)[0],
// FIXME handle no trailing /
name: this._fieldPattern.exec(payload)[0] name: this._fieldPattern.exec(payload)[0]
} }
} }
......
CMS.Models.AssignmentGrade = Backbone.Model.extend({ CMS.Models.AssignmentGrade = Backbone.Model.extend({
idAttribute : "cid", // not sure if this is kosher
defaults : { defaults : {
graderType : null, // the type label (string). May be "Not Graded" which implies None. I'd like to use id but that's ephemeral graderType : 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 location : null // A location object
...@@ -35,7 +34,7 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({ ...@@ -35,7 +34,7 @@ CMS.Views.OverviewAssignmentGrader = Backbone.View.extend({
this.template = _.template( this.template = _.template(
// TODO move to a template file // TODO move to a template file
'<h4 class="status-label"><%= assignmentType %></h4>' + '<h4 class="status-label"><%= assignmentType %></h4>' +
'<a data-tooltip="Mark/unmark this section as graded" class="menu-toggle" href="#">' + '<a data-tooltip="Mark/unmark this subsection as graded" class="menu-toggle" href="#">' +
'<span class="ss-icon ss-standard">&#x2713;</span>' + '<span class="ss-icon ss-standard">&#x2713;</span>' +
'</a>' + '</a>' +
'<ul class="menu">' + '<ul class="menu">' +
......
...@@ -124,11 +124,11 @@ ...@@ -124,11 +124,11 @@
<script src="${static.url('js/vendor/timepicker/datepair.js')}"></script> <script src="${static.url('js/vendor/timepicker/datepair.js')}"></script>
<script src="${static.url('js/vendor/date.js')}"></script> <script src="${static.url('js/vendor/date.js')}"></script>
<script type="text/javascript"> <script type="text/javascript">
(function() { // (function() {
$body = $('body'); // $body = $('body');
$('.gradable-status .menu-toggle').bind('click', showGradeMenu); // $('.gradable-status .menu-toggle').bind('click', showGradeMenu);
$('.gradable-status .menu').bind('click', selectGradeType); // $('.gradable-status .menu').bind('click', selectGradeType);
})(); // })();
$(document).ready(function() { $(document).ready(function() {
// expand the due-date area if the values are set // expand the due-date area if the values are set
...@@ -140,33 +140,25 @@ ...@@ -140,33 +140,25 @@
}) })
// grading status // grading status
function showGradeMenu(e) { // function selectGradeType(e) {
// e.preventDefault();
$section = $(this).closest('.gradable-status'); // var $section = $(this).closest('.gradable-status');
// $section.find('.menu li a').removeClass('is-selected');
e.preventDefault();
$section.toggleClass('is-active');
}
function selectGradeType(e) { // var $target = $(e.target).addClass('is-selected');
e.preventDefault(); // var $label = $section.find('.status-label');
var $section = $(this).closest('.gradable-status'); // $section.removeClass('is-active');
$section.find('.menu li a').removeClass('is-selected'); // $label.html($target.html());
// if ($target.hasClass('gradable-status-notgraded')) {
var $target = $(e.target).addClass('is-selected'); // $section.removeClass('is-set');
var $label = $section.find('.status-label'); // }
// else {
$section.removeClass('is-active'); // $section.addClass('is-set');
$label.html($target.html()); // }
// }
if ($target.hasClass('gradable-status-notgraded')) {
$section.removeClass('is-set');
}
else {
$section.addClass('is-set');
}
}
</script> </script>
</%block> </%block>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment