Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 10 additions & 26 deletions cms/static/js/views/modals/edit_section_in_outline.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
*/
define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
"js/models/xblock_info", "date", "js/views/utils/xblock_utils",
"js/collections/course_grader", "js/views/overview_assignment_grader",
"js/utils/get_date"],
"js/collections/course_grader", "js/utils/get_date"],
function($, _, gettext, BaseModal, XBlockInfo, date, XBlockViewUtils,
CourseGraderCollection, OverviewAssignmentGrader,
DateUtils) {
CourseGraderCollection, DateUtils) {
var EditSectionXBlockModal = BaseModal.extend({
events : {
"click .action-save": "save",
Expand All @@ -19,7 +17,7 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
options: $.extend({}, BaseModal.prototype.options, {
modalName: 'edit-xblock',
addSaveButton: true,
modalSize: 'med'
modalSize: 'large'
}),

initialize: function() {
Expand All @@ -29,14 +27,6 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
this.xblockInfo = this.options.model;
this.date = date;
this.graderTypes = new CourseGraderCollection(JSON.parse(this.xblockInfo.get('course_graders')), {parse:true});
this.SelectGraderView = OverviewAssignmentGrader.extend({
selectGradeType : function(e) {
e.preventDefault();
this.removeMenu(e);
this.assignmentGrade.set('graderType', ($(e.target).hasClass('gradable-status-notgraded')) ? 'notgraded' : $(e.target).text());
this.render();
}
})
},


Expand All @@ -57,6 +47,7 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
return this.template({
xblockInfo: this.xblockInfo,
getDateTime: this.getDateTime,
graderTypes: this.graderTypes,
date: this.date,
});
},
Expand All @@ -76,11 +67,7 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
BaseModal.prototype.render.call(this);
this.$el.find('.date').datepicker({'dateFormat': 'm/d/yy'});
this.$el.find('.time').timepicker({'timeFormat' : 'H:i'});
new this.SelectGraderView({
el : this.$el.find('.gradable-status'),
graders : this.graderTypes,
hideSymbol : true,
});
this.$el.find('.edit-outline-item-modal #grading_type').val(this.xblockInfo.get('format'))

function removeDateSetter(e) {
e.preventDefault();
Expand All @@ -104,8 +91,8 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
var releaseDatetime, metadata, dueDatetime, graderType, objectToSave;
event.preventDefault();
releaseDatetime = DateUtils(
$('.edit-section-modal #start_date'),
$('.edit-section-modal #start_time')
$('.edit-outline-item-modal #start_date'),
$('.edit-outline-item-modal #start_time')
);
// Check releaseDatetime and dueDatetime for sanity?
metadata = {
Expand All @@ -114,14 +101,11 @@ define(["jquery", "underscore", "gettext", "js/views/modals/base_modal",
objectToSave = {metadata: metadata};
if (this.xblockInfo.get('category') === 'sequential') {
var dueDatetime = DateUtils(
$('.edit-section-modal #due_date'),
$('.edit-section-modal #due_time')
$('.edit-outline-item-modal #due_date'),
$('.edit-outline-item-modal #due_time')
);
metadata.due_date = dueDatetime;
graderType = $('.edit-section-modal .gradable .gradable-status .status-label')[0].firstChild.textContent;
if (graderType === "Not Graded") {
graderType = "notgraded";
}
graderType = $('.edit-outline-item-modal #grading_type').val();
objectToSave = {metadata: metadata, graderType: graderType}
}
XBlockViewUtils.updateXBlockFields(this.xblockInfo, objectToSave, true).done(
Expand Down
35 changes: 35 additions & 0 deletions cms/static/sass/elements/_modal-window.scss
Original file line number Diff line number Diff line change
Expand Up @@ -334,3 +334,38 @@
filter: alpha(opacity=50);
}
}

// applications of modal
// ------------------------
.modal-window {

.modal-section {
margin-bottom: $baseline;

&:last-child {
margin-bottom: 0;
}
}

.modal-section-title {
@extend %t-title6;
margin: 0 0 ($baseline*0.75) 0;
border-bottom: 1px solid $gray-l4;
padding-bottom: ($baseline/2);
color: $gray-d2;
font-weight: 600;
}

.modal-section-content {

.list-fields, .list-actions {
display: inline-block;
vertical-align: middle;
}

.list-actions {
@extend %actions-list;
margin-left: ($baseline/4);
}
}
}
Loading