diff --git a/cms/static/coffee/src/views/unit.coffee b/cms/static/coffee/src/views/unit.coffee
index 91740a2b04..e7cb5574eb 100644
--- a/cms/static/coffee/src/views/unit.coffee
+++ b/cms/static/coffee/src/views/unit.coffee
@@ -98,6 +98,9 @@ class CMS.Views.UnitEdit extends Backbone.View
@$editor = $($('#html-editor').html())
$preview = $('
')
initHTMLEditor(@$editor, $preview)
+ when 'discussion'
+ @$editor = $($('#discussion-editor').html())
+ $preview = $($('#discussion-preview').html())
@$editor.find('.save-button, .cancel-button').bind('click', =>
@$componentItem.removeClass('editing')
@@ -108,6 +111,7 @@ class CMS.Views.UnitEdit extends Backbone.View
@$componentItem.append(@$editor)
@$componentItem.append($preview)
+
@$componentItem.append($componentActions)
@$componentItem.hide()
@$newComponentItem.before(@$componentItem)
diff --git a/cms/static/img/new-post-icon.png b/cms/static/img/new-post-icon.png
new file mode 100644
index 0000000000..bf16b9da89
Binary files /dev/null and b/cms/static/img/new-post-icon.png differ
diff --git a/cms/static/img/show-hide-discussion-icon.png b/cms/static/img/show-hide-discussion-icon.png
new file mode 100644
index 0000000000..17d3193780
Binary files /dev/null and b/cms/static/img/show-hide-discussion-icon.png differ
diff --git a/cms/static/js/html-editor.js b/cms/static/js/html-editor.js
index 9d530b6199..9a84e26820 100644
--- a/cms/static/js/html-editor.js
+++ b/cms/static/js/html-editor.js
@@ -5,7 +5,6 @@ var htmlEditor;
function initHTMLEditor($editor, $prev) {
$htmlEditor = $editor;
- console.log($editor.find('.edit-box'));
htmlEditor = CodeMirror.fromTextArea($editor.find('.edit-box')[0], {
lineWrapping: true,
mode: 'xml',
@@ -15,9 +14,13 @@ function initHTMLEditor($editor, $prev) {
currentEditor = htmlEditor;
- $(htmlEditor.getWrapperElement()).css('background', '#fff');
-
- $(htmlEditor.getWrapperElement()).bind('click', setFocus);
+ $(htmlEditor.getWrapperElement()).css({
+ 'background': '#fff'
+ });
+ $(htmlEditor.getWrapperElement()).bind('click', function() {
+ $(htmlEditor).focus();
+ });
+ $(htmlEditor).focus();
$htmlPreview = $prev;
}
diff --git a/cms/static/js/speed-editor.js b/cms/static/js/speed-editor.js
index b2499324cb..cfd2b96419 100644
--- a/cms/static/js/speed-editor.js
+++ b/cms/static/js/speed-editor.js
@@ -155,7 +155,7 @@ function updateXML() {
xml = xml.replace(/\{\{video\s(.*)\}\}/g, '\n\n');
// replace string and numerical
- xml = xml.replace(/\=\s*(.*)/g, function(match, p) {
+ xml = xml.replace(/(?:\n|^)\=\s*(.*)/g, function(match, p) {
var string;
var params = /(.*)\+\-\s*(.*)/.exec(p);
if(parseFloat(p)) {
@@ -251,7 +251,7 @@ function updatePreview() {
return groupString;
});
- html = html.replace(/\=\s*(.*)/g, function(match, p) {
+ html = html.replace(/(?:\n|^)\=\s*(.*)/g, function(match, p) {
var value = p.replace(/\+\-.*/g, '');
var string = '\n';
return string;
diff --git a/cms/static/sass/_unit.scss b/cms/static/sass/_unit.scss
index 8fc431694e..febf0a0511 100644
--- a/cms/static/sass/_unit.scss
+++ b/cms/static/sass/_unit.scss
@@ -374,10 +374,79 @@
}
}
- .html-preview {
+ .html-preview,
+ .discussion-preview {
padding: 20px 30px;
}
+ .discussion-id-field {
+ width: 350px;
+ }
+
+ .discussion-module {
+ position: relative;
+ margin: 20px 0;
+ padding: 20px;
+ height: 40px;
+ background: #f6f6f6 !important;
+ border-radius: 3px;
+
+ .discussion-show {
+ position: relative;
+ top: 3px;
+ font-size: 14px;
+ text-align: center;
+ color: #3c3c3c;
+
+ &.shown {
+ .show-hide-discussion-icon {
+ background-position: 0 0;
+ }
+ }
+
+ .show-hide-discussion-icon {
+ display: inline-block;
+ position: relative;
+ top: 5px;
+ margin-right: 6px;
+ width: 21px;
+ height: 19px;
+ background: url(../img/show-hide-discussion-icon.png) no-repeat;
+ background-position: -21px 0;
+ }
+ }
+
+ .new-post-btn {
+ display: inline-block;
+ float: right;
+ height: 35px;
+ padding: 0 15px;
+ border-radius: 3px;
+ border: 1px solid #2d81ad;
+ @include linear-gradient(top, #6dccf1, #38a8e5);
+ font-size: 13px;
+ font-weight: 700;
+ line-height: 32px;
+ color: #fff;
+ text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 1px 1px rgba(0, 0, 0, .15);
+
+ &:hover {
+ border-color: #297095;
+ @include linear-gradient(top, #4fbbe4, #2090d0);
+ }
+ }
+
+ .new-post-icon {
+ display: block;
+ float: left;
+ width: 16px;
+ height: 17px;
+ margin: 7px 7px 0 0;
+ background: url(../img/new-post-icon.png) no-repeat;
+ }
+ }
+
.component-editor {
@include edit-box;
display: none;
diff --git a/cms/templates/unit.html b/cms/templates/unit.html
index 3d5e625caf..f8753f2630 100644
--- a/cms/templates/unit.html
+++ b/cms/templates/unit.html
@@ -155,6 +155,27 @@
+
+
+
+