diff --git a/common/lib/xmodule/xmodule/js/fixtures/problem_content.html b/common/lib/xmodule/xmodule/js/fixtures/problem_content.html
index 7cbfcb4339..e26a65b599 100644
--- a/common/lib/xmodule/xmodule/js/fixtures/problem_content.html
+++ b/common/lib/xmodule/xmodule/js/fixtures/problem_content.html
@@ -1,4 +1,4 @@
-
+
diff --git a/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html b/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html
index b87b5e857e..4e8a6f9028 100644
--- a/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html
+++ b/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html
@@ -1,4 +1,4 @@
-
+
diff --git a/common/static/common/js/discussion/views/discussion_inline_view.js b/common/static/common/js/discussion/views/discussion_inline_view.js
index 39922f1274..03d8cd8634 100644
--- a/common/static/common/js/discussion/views/discussion_inline_view.js
+++ b/common/static/common/js/discussion/views/discussion_inline_view.js
@@ -24,7 +24,6 @@
initialize: function(options) {
var match;
-
this.$el = options.el;
this.readOnly = options.readOnly;
this.showByDefault = options.showByDefault || false;
@@ -32,6 +31,12 @@
this.listenTo(this.model, 'change', this.render);
this.escKey = 27;
+ if (options.startHeader !== undefined) {
+ this.startHeader = options.startHeader;
+ } else {
+ this.startHeader = 4; // Start the header levels at H
+ }
+
match = this.page_re.exec(window.location.href);
if (match) {
this.page = parseInt(match[1], 10);
@@ -73,7 +78,6 @@
var discussionHtml,
user = new DiscussionUser(response.user_info),
self = this;
-
$elem.focus();
window.user = user;
@@ -120,6 +124,7 @@
collection: this.discussion,
course_settings: this.courseSettings,
topicId: discussionId,
+ startHeader: this.startHeader,
is_commentable_cohorted: response.is_commentable_cohorted
});
@@ -146,6 +151,7 @@
el: this.$('.forum-content'),
model: thread,
mode: 'inline',
+ startHeader: this.startHeader,
courseSettings: this.courseSettings
});
this.threadView.render();
diff --git a/common/static/common/js/discussion/views/discussion_thread_edit_view.js b/common/static/common/js/discussion/views/discussion_thread_edit_view.js
index 2db0eed848..950b24db68 100644
--- a/common/static/common/js/discussion/views/discussion_thread_edit_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_edit_view.js
@@ -16,6 +16,7 @@
initialize: function(options) {
this.container = options.container || $('.thread-content-wrapper');
this.mode = options.mode || 'inline';
+ this.startHeader = options.startHeader;
this.course_settings = options.course_settings;
this.threadType = this.model.get('thread_type');
this.topicId = this.model.get('commentable_id');
@@ -28,8 +29,10 @@
var formId = _.uniqueId('form-'),
threadTypeTemplate = edx.HtmlUtils.template($('#thread-type-template').html()),
$threadTypeSelector = $(threadTypeTemplate({form_id: formId}).toString()),
+ context,
mainTemplate = edx.HtmlUtils.template($('#thread-edit-template').html());
- edx.HtmlUtils.setHtml(this.$el, mainTemplate(this.model.toJSON()));
+ context = $.extend({mode: this.mode, startHeader: this.startHeader}, this.model.attributes);
+ edx.HtmlUtils.setHtml(this.$el, mainTemplate(context));
this.container.append(this.$el);
this.$submitBtn = this.$('.post-update');
this.addField($threadTypeSelector);
diff --git a/common/static/common/js/discussion/views/discussion_thread_show_view.js b/common/static/common/js/discussion/views/discussion_thread_show_view.js
index 9e01c6326b..f26a2cb8a3 100644
--- a/common/static/common/js/discussion/views/discussion_thread_show_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_show_view.js
@@ -30,15 +30,16 @@
var _ref;
DiscussionThreadShowView.__super__.initialize.call(this);
this.mode = options.mode || 'inline';
+ this.startHeader = options.startHeader;
if ((_ref = this.mode) !== 'tab' && _ref !== 'inline') {
throw new Error('invalid mode: ' + this.mode);
}
};
DiscussionThreadShowView.prototype.renderTemplate = function() {
- var context;
- context = $.extend({
+ var context = $.extend({
mode: this.mode,
+ startHeader: this.startHeader,
flagged: this.model.isFlagged(),
author_display: this.getAuthorDisplay(),
cid: this.model.cid,
diff --git a/common/static/common/js/discussion/views/discussion_thread_view.js b/common/static/common/js/discussion/views/discussion_thread_view.js
index 3e8838583d..ba8e9a6355 100644
--- a/common/static/common/js/discussion/views/discussion_thread_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_view.js
@@ -80,6 +80,7 @@
this.mode = options.mode || 'inline';
this.context = options.context || 'course';
this.options = _.extend({}, options);
+ this.startHeader = options.startHeader;
if ((_ref = this.mode) !== 'tab' && _ref !== 'inline') {
throw new Error('invalid mode: ' + this.mode);
}
@@ -91,6 +92,7 @@
self.model = collection.get(id);
}
});
+
this.createShowView();
this.responses = new Comments();
this.loadedResponses = false;
@@ -116,7 +118,8 @@
};
DiscussionThreadView.prototype.renderTemplate = function() {
- var container, templateData;
+ var container,
+ templateData;
this.template = _.template($('#thread-template').html());
container = $('#discussion-container');
if (!container.length) {
@@ -124,6 +127,7 @@
}
templateData = _.extend(this.model.toJSON(), {
readOnly: this.readOnly,
+ startHeader: this.startHeader + 1, // this is a child so headers should be increased
can_create_comment: container.data('user-create-comment')
});
return this.template(templateData);
@@ -299,7 +303,8 @@
var view;
response.set('thread', this.model);
view = new ThreadResponseView($.extend({
- model: response
+ model: response,
+ startHeader: this.startHeader + 1 // this is a child so headers should be increased
}, options));
view.on('comment:add', this.addComment);
view.on('comment:endorse', this.endorseThread);
@@ -396,6 +401,7 @@
model: this.model,
mode: this.mode,
context: this.context,
+ startHeader: this.startHeader,
course_settings: this.options.courseSettings
});
this.editView.bind('thread:updated thread:cancel_edit', this.closeEditView);
@@ -415,7 +421,8 @@
DiscussionThreadView.prototype.createShowView = function() {
this.showView = new DiscussionThreadShowView({
model: this.model,
- mode: this.mode
+ mode: this.mode,
+ startHeader: this.startHeader
});
this.showView.bind('thread:_delete', this._delete);
return this.showView.bind('thread:edit', this.edit);
diff --git a/common/static/common/js/discussion/views/new_post_view.js b/common/static/common/js/discussion/views/new_post_view.js
index 1585889b1e..d2537111c2 100644
--- a/common/static/common/js/discussion/views/new_post_view.js
+++ b/common/static/common/js/discussion/views/new_post_view.js
@@ -36,6 +36,7 @@
NewPostView.prototype.initialize = function(options) {
var _ref;
this.mode = options.mode || 'inline';
+ this.startHeader = options.startHeader;
if ((_ref = this.mode) !== 'tab' && _ref !== 'inline') {
throw new Error('invalid mode: ' + this.mode);
}
@@ -45,12 +46,14 @@
};
NewPostView.prototype.render = function() {
- var context, threadTypeTemplate;
+ var context,
+ threadTypeTemplate;
context = _.clone(this.course_settings.attributes);
_.extend(context, {
cohort_options: this.getCohortOptions(),
is_commentable_cohorted: this.is_commentable_cohorted,
mode: this.mode,
+ startHeader: this.startHeader,
form_id: this.mode + (this.topicId ? '-' + this.topicId : '')
});
this.$el.html(_.template($('#new-post-template').html())(context));
diff --git a/common/static/common/js/discussion/views/response_comment_edit_view.js b/common/static/common/js/discussion/views/response_comment_edit_view.js
index a7de68e051..7bd873122a 100644
--- a/common/static/common/js/discussion/views/response_comment_edit_view.js
+++ b/common/static/common/js/discussion/views/response_comment_edit_view.js
@@ -22,7 +22,8 @@
this.ResponseCommentEditView = (function(_super) {
__extends(ResponseCommentEditView, _super);
- function ResponseCommentEditView() {
+ function ResponseCommentEditView(options) {
+ this.options = options;
return ResponseCommentEditView.__super__.constructor.apply(this, arguments);
}
@@ -40,8 +41,10 @@
};
ResponseCommentEditView.prototype.render = function() {
+ var context = $.extend({mode: this.options.mode, startHeader: this.options.startHeader},
+ this.model.attributes);
this.template = _.template($('#response-comment-edit-template').html());
- this.$el.html(this.template(this.model.toJSON()));
+ this.$el.html(this.template(context));
this.delegateEvents();
DiscussionUtil.makeWmdEditor(this.$el, $.proxy(this.$, this), 'edit-comment-body');
return this;
diff --git a/common/static/common/js/discussion/views/response_comment_view.js b/common/static/common/js/discussion/views/response_comment_view.js
index ad870fd877..09149a1860 100644
--- a/common/static/common/js/discussion/views/response_comment_view.js
+++ b/common/static/common/js/discussion/views/response_comment_view.js
@@ -45,7 +45,8 @@
return this.$el.find(selector);
};
- ResponseCommentView.prototype.initialize = function() {
+ ResponseCommentView.prototype.initialize = function(options) {
+ this.startHeader = options.startHeader;
return ResponseCommentView.__super__.initialize.call(this);
};
@@ -84,7 +85,8 @@
this.showView = null;
}
this.editView = new ResponseCommentEditView({
- model: this.model
+ model: this.model,
+ startHeader: this.startHeader
});
this.editView.bind('comment:update', this.update);
this.editView.bind('comment:cancel_edit', this.cancelEdit);
diff --git a/common/static/common/js/discussion/views/thread_response_edit_view.js b/common/static/common/js/discussion/views/thread_response_edit_view.js
index e41a6daf9c..13d2308be1 100644
--- a/common/static/common/js/discussion/views/thread_response_edit_view.js
+++ b/common/static/common/js/discussion/views/thread_response_edit_view.js
@@ -35,13 +35,16 @@
return this.$el.find(selector);
};
- ThreadResponseEditView.prototype.initialize = function() {
+ ThreadResponseEditView.prototype.initialize = function(options) {
+ this.options = options;
return ThreadResponseEditView.__super__.initialize.call(this);
};
ThreadResponseEditView.prototype.render = function() {
+ var context = $.extend({mode: this.options.mode, startHeader: this.options.startHeader},
+ this.model.attributes);
this.template = _.template($('#thread-response-edit-template').html());
- this.$el.html(this.template(this.model.toJSON()));
+ this.$el.html(this.template(context));
this.delegateEvents();
DiscussionUtil.makeWmdEditor(this.$el, $.proxy(this.$, this), 'edit-post-body');
return this;
diff --git a/common/static/common/js/discussion/views/thread_response_view.js b/common/static/common/js/discussion/views/thread_response_view.js
index 88f895665a..077c6cdefd 100644
--- a/common/static/common/js/discussion/views/thread_response_view.js
+++ b/common/static/common/js/discussion/views/thread_response_view.js
@@ -59,6 +59,7 @@
};
ThreadResponseView.prototype.initialize = function(options) {
+ this.startHeader = options.startHeader;
this.collapseComments = options.collapseComments;
this.createShowView();
this.readOnly = $('.discussion-module').data('read-only');
@@ -155,7 +156,8 @@
self = this;
comment.set('thread', this.model.get('thread'));
view = new ResponseCommentView({
- model: comment
+ model: comment,
+ startHeader: this.startHeader
});
view.render();
if (this.readOnly) {
@@ -246,7 +248,8 @@
this.editView.model = this.model;
} else {
this.editView = new ThreadResponseEditView({
- model: this.model
+ model: this.model,
+ startHeader: this.startHeader
});
this.editView.bind('response:update', this.update);
return this.editView.bind('response:cancel_edit', this.cancelEdit);
diff --git a/common/static/common/templates/components/paging-header.underscore b/common/static/common/templates/components/paging-header.underscore
index d41504c484..0c594d7ff8 100644
--- a/common/static/common/templates/components/paging-header.underscore
+++ b/common/static/common/templates/components/paging-header.underscore
@@ -1,5 +1,5 @@
<% if (!_.isUndefined(srInfo)) { %>
- <%- srInfo.text %>
+ <%- srInfo.text %>
<% } %>
diff --git a/common/static/common/templates/discussion/new-post.underscore b/common/static/common/templates/discussion/new-post.underscore
index 8f6c8494ab..1376a2111c 100644
--- a/common/static/common/templates/discussion/new-post.underscore
+++ b/common/static/common/templates/discussion/new-post.underscore
@@ -1,5 +1,6 @@