diff --git a/cms/static/coffee/src/client_templates/course_info_handouts.html b/cms/static/coffee/src/client_templates/course_info_handouts.html new file mode 100644 index 0000000000..f4eccf6857 --- /dev/null +++ b/cms/static/coffee/src/client_templates/course_info_handouts.html @@ -0,0 +1,30 @@ +Edit +
+

Course Handouts

+
    +
  1. + Syllabus +
  2. +
  3. + 6.002x At-A-Glance +
  4. +
  5. + Syllabus +
  6. +
  7. + 6.002x At-A-Glance +
  8. +
  9. + Syllabus +
  10. +
+
+
+
+ +
+
+ Save + Cancel +
+
diff --git a/cms/static/js/views/course_info_edit.js b/cms/static/js/views/course_info_edit.js index cc964dddf9..86fcc0a646 100644 --- a/cms/static/js/views/course_info_edit.js +++ b/cms/static/js/views/course_info_edit.js @@ -13,7 +13,11 @@ CMS.Views.CourseInfoEdit = Backbone.View.extend({ el: this.$('#course-update-view'), collection: this.model.get('updates') }); - // TODO instantiate the handouts view + + new CMS.Views.ClassInfoHandoutsView({ + el: this.$('#course-handouts-view') + // collection: this.model.get('') + }); return this; } }); @@ -169,4 +173,64 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ } }); - \ No newline at end of file + +// the handouts view is dumb right now; it needs tied to a model and all that jazz +CMS.Views.ClassInfoHandoutsView = Backbone.View.extend({ + // collection is CourseUpdateCollection + events: { + "click .save-button" : "onSave", + "click .cancel-button" : "onCancel", + "click .edit-button" : "onEdit" + }, + + initialize: function() { + var self = this; + window.templateLoader.loadRemoteTemplate("course_info_handouts", + "/static/coffee/src/client_templates/course_info_handouts.html", + function (raw_template) { + self.template = _.template(raw_template); + self.render(); + } + ); + }, + + render: function () { + var updateEle = this.$el; + var self = this; + this.$el.append($(this.template())); + this.$preview = this.$el.find('.handouts-content'); + this.$form = this.$el.find(".edit-handouts-form"); + this.$editor = this.$form.find('.handouts-content-editor'); + this.$form.hide(); + + return this; + }, + + onEdit: function(event) { + this.$editor.val(this.$preview.html()); + this.$form.show(); + this.$preview.hide(); + $modalCover.show(); + $modalCover.bind('click', function() { + self.closeEditor(self); + }); + }, + + onSave: function(event) { + this.$form.hide(); + this.closeEditor(this); + }, + + onCancel: function(event) { + this.$form.hide(); + this.closeEditor(this); + }, + + closeEditor: function(self) { + this.$preview.html(this.$editor.val()); + this.$preview.show(); + this.$form.hide(); + $modalCover.unbind('click'); + $modalCover.hide(); + } +}); \ No newline at end of file diff --git a/cms/static/sass/_course-info.scss b/cms/static/sass/_course-info.scss index 5e199b6adf..29c47dbc6a 100644 --- a/cms/static/sass/_course-info.scss +++ b/cms/static/sass/_course-info.scss @@ -121,7 +121,7 @@ .course-handouts { width: 30%; - padding: 20px 25px; + padding: 20px 30px; margin: 0; border-radius: 0 3px 3px 0; border-left: none; @@ -132,21 +132,38 @@ font-weight: 700; } - .new-handout-button { - @include grey-button; - display: block; - text-align: center; - padding: 12px 0; - margin-bottom: 28px; + .edit-button { + float: right; + @include white-button; + padding: 3px 10px 4px; + margin-left: 7px; + font-size: 12px; + font-weight: 400; + + .edit-icon, + .delete-icon { + margin-right: 4px; + } } - li { - margin-bottom: 10px; + .handouts-content { font-size: 14px; } - .new-handout-form { - @include edit-box; - margin-bottom: 24px; + .treeview-handoutsnav li { + margin-bottom: 12px; + } +} + +.edit-handouts-form { + @include edit-box; + position: absolute; + right: 0; + z-index: 10001; + width: 800px; + padding: 30px; + + textarea { + height: 300px; } } \ No newline at end of file diff --git a/cms/templates/course_info.html b/cms/templates/course_info.html index d32d4eb1ec..fe888ac37b 100644 --- a/cms/templates/course_info.html +++ b/cms/templates/course_info.html @@ -46,10 +46,7 @@ - +