Commit 9d2b92c3 by Don Mitchell Committed by marco

Don't show 'empty' metadata field

Change logic for when to show simple v advanced editor to use an
explicit flag.
parent 18ecd115
<%include file="metadata-edit.html" />
<section class="problem-editor editor">
<div class="row">
%if markdown != '' or data == '<problem>\n</problem>\n':
%if enable_markdown:
<div class="editor-bar">
<ul class="format-buttons">
<li><a href="#" class="header-button" data-tooltip="Heading 1"><span
......
......@@ -703,15 +703,15 @@ class CapaDescriptor(RawDescriptor):
def get_context(self):
_context = RawDescriptor.get_context(self)
_context.update({'markdown': self.metadata.get('markdown', '')})
_context.update({'markdown': self.metadata.get('markdown', ''),
'enable_markdown' : 'markdown' in self.metadata})
return _context
@property
def editable_metadata_fields(self):
"""Remove metadata from the editable fields since it has its own editor"""
subset = super(CapaDescriptor, self).editable_metadata_fields
if 'markdown' in subset:
subset.remove('markdown')
subset = [field for field in super(CapaDescriptor,self).editable_metadata_fields
if field not in ['markdown', 'empty']]
return subset
......
......@@ -172,6 +172,13 @@ class HtmlDescriptor(XmlDescriptor, EditingDescriptor):
elt.set("filename", relname)
return elt
@property
def editable_metadata_fields(self):
"""Remove metadata from the editable fields since it has its own editor"""
subset = [field for field in super(HtmlDescriptor,self).editable_metadata_fields
if field not in ['empty']]
return subset
class AboutDescriptor(HtmlDescriptor):
"""
......
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