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