Commit 62d389c8 by Don Mitchell Committed by marco

Added empty metadata attribute instead of using name to determine which

template is empty (very awkward b/c it's a template descriptor not an
instance one)
Changed display conditionals to get the right things to show in the
right tabs for problems
parent c238fc3d
......@@ -273,7 +273,7 @@ def edit_unit(request, location):
template.display_name,
template.location.url(),
'markdown' in template.metadata,
template.location.name == 'Empty'
'empty' in template.metadata
))
components = [
......
......@@ -31,7 +31,6 @@
<script type="text/javascript" src="${static.url('js/vendor/markitup/sets/wiki/set.js')}"></script>
<script src="${static.url('js/vendor/symbolset.ss-standard.js')}"></script>
<script src="${static.url('js/vendor/symbolset.ss-symbolicons.js')}"></script>
<script src="${static.url('js/vendor/jquery.ui.tabs.js')}"></script>
<%static:js group='main'/>
<%static:js group='module-js'/>
......
......@@ -64,8 +64,7 @@
</div>
% for type, templates in sorted(component_templates.items()):
<div class="new-component-templates new-component-${type}">
<div class="tab-group">
<div class="tabs">
<div class="tab-group tabs">
<ul class="problem-type-tabs nav-tabs">
<li class="current">
<a class="link-tab" href="#tab1">Common Problem Types</a>
......@@ -77,59 +76,51 @@
<div class="tab current" id="tab1">
<ul class="new-component-template">
% for name, location, has_markdown, is_empty in templates:
% if is_empty:
<li class="editor-md empty">
<a href="#" data-location="${location}">
<span class="name"> ${name}</span>
</a>
</li>
% elif has_markdown:
<li class="editor-md">
<a href="#" data-location="${location}">
<span class="name"> ${name}</span>
</a>
</li>
% else:
<li class="editor-manual">
<a href="#" data-location="${location}">
<span class="name">${name}</span>
</a>
% if has_markdown or type != "problem":
% if is_empty:
<li class="editor-md empty">
<a href="#" data-location="${location}">
<span class="name"> ${name}</span>
</a>
</li>
</li>
% else:
<li class="editor-md">
<a href="#" data-location="${location}">
<span class="name"> ${name}</span>
</a>
</li>
% endif
% endif
%endfor
</ul>
</div>
<div class="tab" id="tab2">
<ul class="new-component-template" id="tab2">
% for name, location, has_markdown, is_empty in templates:
% if is_empty:
<li class="editor-md empty">
<a href="#" data-location="${location}">
<span class="name">${name}</span>
</a>
</li>
% elif has_markdown:
% else:
<li class="editor-manual">
<a href="#" data-location="${location}">
<span class="name"> ${name}</span>
</a>
</li>
% endif
%endfor
<ul class="new-component-template">
% if type == "problem":
% for name, location, has_markdown, is_empty in templates:
% if not has_markdown:
% if is_empty:
<li class="editor-manual empty">
<a href="#" data-location="${location}">
<span class="name">${name}</span>
</a>
</li>
% else:
<li class="editor-manual">
<a href="#" data-location="${location}">
<span class="name"> ${name}</span>
</a>
</li>
% endif
% endif
% endfor
% endif
</ul>
</div>
</div>
</div>
<a href="#" class="cancel-button">Cancel</a>
</div>
......
---
metadata:
display_name: Empty
display_name: Blank HTML Page
empty: True
data: |
......
---
metadata:
display_name: Empty
display_name: Blank Common Problem
rerandomize: never
showanswer: always
markdown: ""
weight: ""
empty: True
attempts: ""
data: |
<problem>
......
---
metadata:
display_name: Blank Advanced Problem
rerandomize: never
showanswer: always
weight: ""
attempts: ""
empty: True
data: |
<problem>
</problem>
children: []
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