Commit e3b302f5 by cahrens

Merge branch 'feature/cale/cms-master' into feature/christina/misc

parents 808cf8c6 795b38f0
...@@ -62,6 +62,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -62,6 +62,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
}, },
onNew: function(event) { onNew: function(event) {
event.preventDefault();
var self = this; var self = this;
// create new obj, insert into collection, and render this one ele overriding the hidden attr // create new obj, insert into collection, and render this one ele overriding the hidden attr
var newModel = new CMS.Models.CourseUpdate(); var newModel = new CMS.Models.CourseUpdate();
...@@ -94,6 +95,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -94,6 +95,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
}, },
onSave: function(event) { onSave: function(event) {
event.preventDefault();
var targetModel = this.eventModel(event); var targetModel = this.eventModel(event);
targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() }); targetModel.set({ date : this.dateEntry(event).val(), content : this.$codeMirror.getValue() });
// push change to display, hide the editor, submit the change // push change to display, hide the editor, submit the change
...@@ -102,6 +104,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -102,6 +104,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
}, },
onCancel: function(event) { onCancel: function(event) {
event.preventDefault();
// change editor contents back to model values and hide the editor // change editor contents back to model values and hide the editor
$(this.editor(event)).hide(); $(this.editor(event)).hide();
var targetModel = this.eventModel(event); var targetModel = this.eventModel(event);
...@@ -109,6 +112,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -109,6 +112,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
}, },
onEdit: function(event) { onEdit: function(event) {
event.preventDefault();
var self = this; var self = this;
this.$currentPost = $(event.target).closest('li'); this.$currentPost = $(event.target).closest('li');
this.$currentPost.addClass('editing'); this.$currentPost.addClass('editing');
...@@ -131,6 +135,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({ ...@@ -131,6 +135,7 @@ CMS.Views.ClassInfoUpdateView = Backbone.View.extend({
}, },
onDelete: function(event) { onDelete: function(event) {
event.preventDefault();
// TODO ask for confirmation // TODO ask for confirmation
// remove the dom element and delete the model // remove the dom element and delete the model
var targetModel = this.eventModel(event); var targetModel = this.eventModel(event);
......
...@@ -175,6 +175,7 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({ ...@@ -175,6 +175,7 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
} }
this.$el.find(this.fieldToSelectorMap['overview']).val(this.model.get('overview')); this.$el.find(this.fieldToSelectorMap['overview']).val(this.model.get('overview'));
this.codeMirrorize(null, $('#course-overview')[0]);
this.$el.find('.current-course-introduction-video iframe').attr('src', this.model.videosourceSample()); this.$el.find('.current-course-introduction-video iframe').attr('src', this.model.videosourceSample());
if (this.model.has('intro_video')) { if (this.model.has('intro_video')) {
...@@ -272,11 +273,18 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({ ...@@ -272,11 +273,18 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({
} }
}, },
codeMirrors : {}, codeMirrors : {},
codeMirrorize : function(e) { codeMirrorize : function(e, forcedTarget) {
if (!this.codeMirrors[e.currentTarget.id]) { if (forcedTarget) {
thisTarget = forcedTarget;
thisTarget.id = $(thisTarget).attr('id');
} else {
thisTarget = e.currentTarget;
}
if (!this.codeMirrors[thisTarget.id]) {
var cachethis = this; var cachethis = this;
var field = this.selectorToField['#' + e.currentTarget.id]; var field = this.selectorToField['#' + thisTarget.id];
this.codeMirrors[e.currentTarget.id] = CodeMirror.fromTextArea(e.currentTarget, { this.codeMirrors[thisTarget.id] = CodeMirror.fromTextArea(thisTarget, {
mode: "text/html", lineNumbers: true, lineWrapping: true, mode: "text/html", lineNumbers: true, lineWrapping: true,
onBlur : function(mirror) { onBlur : function(mirror) {
mirror.save(); mirror.save();
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
} }
h2 { h2 {
margin: 30px 40px; margin: 30px 40px 30px 0;
color: #646464; color: #646464;
font-size: 19px; font-size: 19px;
font-weight: 300; font-weight: 300;
...@@ -468,17 +468,21 @@ ...@@ -468,17 +468,21 @@
body.unit { body.unit {
.component { .component {
padding-top: 30px; padding-top: 30px;
.component-actions { .component-actions {
@include box-sizing(border-box); @include box-sizing(border-box);
position: absolute; position: absolute;
width: 811px; width: 811px;
padding: 15px; padding: 15px;
top: 0; top: 0;
left: 0; left: 0;
border-bottom: 1px solid $lightBluishGrey2; border-bottom: 1px solid $lightBluishGrey2;
background: $lightGrey; background: $lightGrey;
}
} }
&.editing {
padding-top: 0;
}
}
} }
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
<script src="${static.url('js/vendor/jquery.leanModal.min.js')}"></script> <script src="${static.url('js/vendor/jquery.leanModal.min.js')}"></script>
<script src="${static.url('js/vendor/jquery.tablednd.js')}"></script> <script src="${static.url('js/vendor/jquery.tablednd.js')}"></script>
<script src="${static.url('js/vendor/jquery.form.js')}"></script> <script src="${static.url('js/vendor/jquery.form.js')}"></script>
<script type="text/javascript" src="${static.url('coffee/src/discussion/tooltip_manager.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/CodeMirror/htmlmixed.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/CodeMirror/htmlmixed.js')}"></script>
<script type="text/javascript" src="${static.url('js/vendor/CodeMirror/css.js')}"></script> <script type="text/javascript" src="${static.url('js/vendor/CodeMirror/css.js')}"></script>
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -212,7 +212,7 @@ from contentstore import utils ...@@ -212,7 +212,7 @@ from contentstore import utils
<label for="course-overview">Course Overview:</label> <label for="course-overview">Course Overview:</label>
<div class="field"> <div class="field">
<div class="input"> <div class="input">
<textarea class="long tall edit-box tinymce" id="course-overview"></textarea> <textarea class="long tall tinymce text-editor" id="course-overview"></textarea>
<span class="tip tip-stacked">Introductions, prerequisites, FAQs that are used on <a href="${utils.get_lms_link_for_item(context_course.location, True)}">your course summary page</a></span> <span class="tip tip-stacked">Introductions, prerequisites, FAQs that are used on <a href="${utils.get_lms_link_for_item(context_course.location, True)}">your course summary page</a></span>
</div> </div>
</div> </div>
......
...@@ -26,8 +26,8 @@ This def will enumerate through a passed in subsection and list all of the units ...@@ -26,8 +26,8 @@ This def will enumerate through a passed in subsection and list all of the units
</a> </a>
% if actions: % if actions:
<div class="item-actions"> <div class="item-actions">
<a href="#" class="delete-button" data-id="${unit.location}"><span class="delete-icon"></span></a> <a href="#" data-tooltip="Delete this unit" class="delete-button" data-id="${unit.location}"><span class="delete-icon"></span></a>
<a href="#" class="drag-handle"></a> <a href="#" data-tooltip="Drag to sort" class="drag-handle"></a>
</div> </div>
% endif % endif
</div> </div>
......
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