Allow single-click creation of course components that only have one template.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class CMS.Views.UnitEdit extends Backbone.View
|
||||
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-templates .new-component-template a': 'saveNewComponent'
|
||||
'click .new-component-templates .cancel-button': 'closeNewComponent'
|
||||
|
||||
@@ -53,13 +53,22 @@
|
||||
<div class="new-component">
|
||||
<h5>Add New Component</h5>
|
||||
<ul class="new-component-type">
|
||||
% for type in sorted(component_templates.keys()):
|
||||
<li>
|
||||
<a href="#" data-type="${type}">
|
||||
<span class="large-template-icon large-${type}-icon"></span>
|
||||
<span class="name">${type}</span>
|
||||
</a>
|
||||
</li>
|
||||
% for type, templates in sorted(component_templates.items()):
|
||||
% if len(templates) == 1:
|
||||
<li>
|
||||
<a href="#" class="single_template" data-type="${type}" data-location="${templates[0][1]}">
|
||||
<span class="large-template-icon large-${type}-icon"></span>
|
||||
<span class="name">${type}</span>
|
||||
</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
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user