Commit 76f2ef6f by Don Mitchell

Empty template now recognized as allowing markdown editing

Save saves markdown and updates the xml
parent 735aa134
......@@ -55,7 +55,7 @@ class CMS.Views.ModuleEdit extends Backbone.View
clickSaveButton: (event) =>
event.preventDefault()
data = @module.save()
data.metadata = @metadata()
data.metadata = _.extend(data.metadata, @metadata())
$modalCover.hide()
@model.save(data).done( =>
# # showToastMessage("Your changes have been saved.", null, 3)
......
<%include file="metadata-edit.html" />
<section class="problem-editor editor">
<div class="row">
%if markdown != '' or data == '':
%if markdown != '' or data == '<problem>\n</problem>\n':
<div class="editor-bar">
<ul class="format-buttons">
<li><a href="#" class="multiple-choice-button" data-tooltip="Multiple Choice"><span
......
......@@ -61,7 +61,15 @@ class @MarkdownEditingDescriptor extends XModule.Descriptor
save: ->
$body.off('click', '.editor-tabs .tab', @changeEditor)
$body.off('click', '.editor-bar a', @onToolbarButton);
data: @xml_editor.getValue()
# TODO when logic is in place to remove the markdown if xml is edited, ensure this doesn't overwrite that
if @current_editor == @markdown_editor
{
data: MarkdownEditingDescriptor.markdownToXml(@markdown_editor.getValue())
metadata:
markdown: @markdown_editor.getValue()
}
else
data: @xml_editor.getValue()
@insertMultipleChoice: (selectedText) ->
return MarkdownEditingDescriptor.insertGenericChoice(selectedText, '(', ')', MarkdownEditingDescriptor.multipleChoiceTemplate)
......
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