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
This commit is contained in:
Don Mitchell
2013-02-08 11:50:27 -05:00
committed by marco
parent c238fc3d74
commit 62d389c853
6 changed files with 55 additions and 50 deletions

View File

@@ -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 = [

View File

@@ -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'/>

View File

@@ -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>

View File

@@ -1,6 +1,7 @@
---
metadata:
display_name: Empty
display_name: Blank HTML Page
empty: True
data: |

View File

@@ -1,10 +1,11 @@
---
metadata:
display_name: Empty
display_name: Blank Common Problem
rerandomize: never
showanswer: always
markdown: ""
weight: ""
empty: True
attempts: ""
data: |
<problem>

View File

@@ -0,0 +1,13 @@
---
metadata:
display_name: Blank Advanced Problem
rerandomize: never
showanswer: always
weight: ""
attempts: ""
empty: True
data: |
<problem>
</problem>
children: []