Commit 4e152952 by Brian Talbot

cms settings - revised course overview textarea to display as codemirror field on page load

parent 91713cbe
...@@ -177,6 +177,7 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({ ...@@ -177,6 +177,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')) {
...@@ -268,11 +269,18 @@ CMS.Views.Settings.Details = CMS.Views.ValidatingView.extend({ ...@@ -268,11 +269,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();
......
...@@ -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>
......
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