Commit 68581610 by Peter Fogg

Allow single-click creation of course components that only have one template.

parent 56ed47b3
class CMS.Views.UnitEdit extends Backbone.View class CMS.Views.UnitEdit extends Backbone.View
events: events:
'click .new-component .new-component-type a': 'showComponentTemplates' 'click .new-component .new-component-type a.multiple_templates': 'showComponentTemplates'
'click .new-component .new-component-type a.single_template': 'saveNewComponent'
'click .new-component .cancel-button': 'closeNewComponent' 'click .new-component .cancel-button': 'closeNewComponent'
'click .new-component-templates .new-component-template a': 'saveNewComponent' 'click .new-component-templates .new-component-template a': 'saveNewComponent'
'click .new-component-templates .cancel-button': 'closeNewComponent' 'click .new-component-templates .cancel-button': 'closeNewComponent'
......
...@@ -53,13 +53,22 @@ ...@@ -53,13 +53,22 @@
<div class="new-component"> <div class="new-component">
<h5>Add New Component</h5> <h5>Add New Component</h5>
<ul class="new-component-type"> <ul class="new-component-type">
% for type in sorted(component_templates.keys()): % for type, templates in sorted(component_templates.items()):
<li> % if len(templates) == 1:
<a href="#" data-type="${type}"> <li>
<span class="large-template-icon large-${type}-icon"></span> <a href="#" class="single_template" data-type="${type}" data-location="${templates[0][1]}">
<span class="name">${type}</span> <span class="large-template-icon large-${type}-icon"></span>
</a> <span class="name">${type}</span>
</li> </a>
</li>
% else:
<li>
<a href="#" class="multiple_templates" data-type="${type}">
<span class="large-template-icon large-${type}-icon"></span>
<span class="name">${type}</span>
</a>
</li>
% endif
% endfor % endfor
</ul> </ul>
</div> </div>
......
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