Merge branch 'feature/cas/speed-editor' of github.com:MITx/mitx into feature/cas/speed-editor
Conflicts: common/lib/xmodule/xmodule/js/src/problem/edit.coffee
This commit is contained in:
@@ -73,6 +73,10 @@ class XModuleItemFactory(Factory):
|
||||
|
||||
@classmethod
|
||||
def _create(cls, target_class, *args, **kwargs):
|
||||
"""
|
||||
kwargs must include parent_location, template. Can contain display_name
|
||||
target_class is ignored
|
||||
"""
|
||||
|
||||
DETACHED_CATEGORIES = ['about', 'static_tab', 'course_info']
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ from xmodule.modulestore.django import modulestore
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.course_module import CourseDescriptor
|
||||
from xmodule.modulestore.xml_exporter import export_to_xml
|
||||
from cms.djangoapps.contentstore.utils import get_modulestore
|
||||
from xmodule.capa_module import CapaDescriptor
|
||||
|
||||
def parse_json(response):
|
||||
"""Parse response, which is assumed to be json"""
|
||||
@@ -438,13 +440,23 @@ class ContentStoreTest(TestCase):
|
||||
self.assertContains(resp, '/c4x/edX/full/asset/handouts_schematic_tutorial.pdf')
|
||||
|
||||
|
||||
def test_capa_module(self):
|
||||
"""Test that a problem w/ markdown has markdown and uses the right html etc"""
|
||||
CourseFactory.create(org='MITx', course='999', display_name='Robot Super Course')
|
||||
|
||||
problem_data = {
|
||||
'parent_location' : 'i4x://MITx/999/course/Robot_Super_Course',
|
||||
'template' : 'i4x://edx/templates/problem/Empty'
|
||||
}
|
||||
|
||||
resp = self.client.post(reverse('clone_item'), problem_data)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
self.assertEqual(resp.status_code, 200)
|
||||
payload = parse_json(resp)
|
||||
problem_loc = payload['id']
|
||||
problem = get_modulestore(problem_loc).get_item(problem_loc)
|
||||
# should be a CapaDescriptor
|
||||
self.assertIsInstance(problem, CapaDescriptor, "New problem is not a CapaDescriptor")
|
||||
context = problem.get_context()
|
||||
self.assertIn('markdown', context, "markdown is missing")
|
||||
self.assertNotIn('markdown', problem.editable_metadata_fields, "Markdown slipped into the editable metadata fields")
|
||||
@@ -271,7 +271,8 @@ def edit_unit(request, location):
|
||||
component_templates[template.location.category].append((
|
||||
template.display_name,
|
||||
template.location.url(),
|
||||
'markdown' in template.metadata
|
||||
'markdown' in template.metadata,
|
||||
template.location.name == 'Empty'
|
||||
))
|
||||
|
||||
components = [
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -152,13 +152,16 @@
|
||||
% for type, templates in sorted(component_templates.items()):
|
||||
<div class="new-component-templates new-component-${type}">
|
||||
<ul class="new-component-template">
|
||||
% for name, location, has_markdown in templates:
|
||||
% for name, location, has_markdown, is_empty in templates:
|
||||
<li>
|
||||
<a href="#" data-location="${location}">
|
||||
<span class="name">${name}
|
||||
% if has_markdown:
|
||||
MD
|
||||
% endif
|
||||
% if is_empty:
|
||||
<i>rasa</i>
|
||||
% endif
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%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
|
||||
|
||||
Reference in New Issue
Block a user