diff --git a/cms/static/js/base.js b/cms/static/js/base.js
index dd9065dd07..718c106c76 100644
--- a/cms/static/js/base.js
+++ b/cms/static/js/base.js
@@ -77,6 +77,15 @@ $(document).ready(function() {
$('.new-course-button').bind('click', addNewCourse);
+ // section name editing
+ $('.section-name').bind('click', editSectionName);
+ $('.edit-section-name-cancel').bind('click', cancelEditSectionName);
+ $('.edit-section-name-save').bind('click', saveEditSectionName);
+
+ // section date setting
+ $('.set-publish-date').bind('click', setSectionScheduleDate);
+ $('.edit-section-start-cancel').bind('click', cancelSetSectionScheduleDate);
+ $('.edit-section-start-save').bind('click', saveSetSectionScheduleDate);
});
function showImportSubmit(e) {
@@ -180,10 +189,7 @@ function onSectionReordered() {
});
}
-function getEdxTimeFromDateTimeInputs(date_id, time_id, format) {
- var input_date = $('#'+date_id).val();
- var input_time = $('#'+time_id).val();
-
+function getEdxTimeFromDateTimeVals(date_val, time_val, format) {
var edxTimeStr = null;
if (input_date != '') {
@@ -201,6 +207,13 @@ function getEdxTimeFromDateTimeInputs(date_id, time_id, format) {
return edxTimeStr;
}
+function getEdxTimeFromDateTimeInputs(date_id, time_id, format) {
+ var input_date = $('#'+date_id).val();
+ var input_time = $('#'+time_id).val();
+
+ return getEdxTimeFromDateTimeVals(input_date, input_time, format);
+}
+
function saveSubsection(e) {
e.preventDefault();
@@ -586,3 +599,77 @@ function cancelNewSubsection(e) {
e.preventDefault();
$(this).parents('li.branch').remove();
}
+
+function editSectionName(e) {
+ e.preventDefault();
+ $(this).children('div.section-name-edit').show();
+ $(this).children('span.section-name-span').hide();
+}
+
+function cancelEditSectionName(e) {
+ e.preventDefault();
+ $(this).parent().hide();
+ $(this).parent().siblings('span.section-name-span').show();
+ e.stopPropagation();
+}
+
+function saveEditSectionName(e) {
+ e.preventDefault();
+
+ id = $(this).closest("section.courseware-section").data("id");
+ display_name = $(this).prev('.edit-section-name').val();
+
+ var $_this = $(this);
+ // call into server to commit the new order
+ $.ajax({
+ url: "/save_item",
+ type: "POST",
+ dataType: "json",
+ contentType: "application/json",
+ data:JSON.stringify({ 'id' : id, 'metadata' : {'display_name' : display_name}, 'data': null, 'children' : null})
+ }).success(function()
+ {
+ alert('Your changes have been saved.');
+ $_this.parent().siblings('span.section-name-span').html(display_name);
+ $_this.parent().siblings('span.section-name-span').show();
+ $_this.parent().hide();
+ e.stopPropagation();
+ });
+}
+
+function setSectionScheduleDate(e) {
+ e.preventDefault();
+ $(this).closest("h4").hide();
+ $(this).parent().siblings(".datepair").show();
+}
+
+function cancelSetSectionScheduleDate(e) {
+ e.preventDefault();
+ $(this).closest(".datepair").hide();
+ $(this).parent().siblings("h4").show();
+}
+
+function saveSetSectionScheduleDate(e) {
+ e.preventDefault();
+
+ input_date = $(this).siblings('input.date').val();
+ input_time = $(this).siblings('input.time').val();
+
+ start = getEdxTimeFromDateTimeVals(input_date, input_time);
+
+ id = $(this).closest("section.courseware-section").data("id");
+ var $_this = $(this);
+
+ // call into server to commit the new order
+ $.ajax({
+ url: "/save_item",
+ type: "POST",
+ dataType: "json",
+ contentType: "application/json",
+ data:JSON.stringify({ 'id' : id, 'metadata' : {'start' : start}, 'data': null, 'children' : null})
+ }).success(function()
+ {
+ alert('Your changes have been saved.');
+ location.reload();
+ });
+}
\ No newline at end of file
diff --git a/cms/static/sass/_courseware.scss b/cms/static/sass/_courseware.scss
index 40e34375f6..15b7882069 100644
--- a/cms/static/sass/_courseware.scss
+++ b/cms/static/sass/_courseware.scss
@@ -45,7 +45,7 @@ input.courseware-unit-search-input {
}
header {
- height: 47px;
+ height: 67px;
.item-details {
float: left;
@@ -80,7 +80,6 @@ input.courseware-unit-search-input {
}
h4 {
- display: none;
font-size: 12px;
color: #878e9d;
diff --git a/cms/templates/overview.html b/cms/templates/overview.html
index 9739f4c1a2..f4055145fa 100644
--- a/cms/templates/overview.html
+++ b/cms/templates/overview.html
@@ -1,9 +1,23 @@
<%inherit file="base.html" />
+<%!
+ from time import mktime
+ import dateutil.parser
+ import logging
+ from datetime import datetime
+%>
<%! from django.core.urlresolvers import reverse %>
<%block name="title">CMS Courseware Overview%block>
+<%namespace name='static' file='static_content.html'/>
<%namespace name="units" file="widgets/units.html" />
+<%block name="jsextra">
+
+
+
+
+%block>
+
<%block name="header_extras">