Commit a9927727 by Chris Dodge

add new files

parent 9cc1af50
class CMS.Views.TabsEdit extends Backbone.View
events:
'click .new-tab': 'addNewTab'
initialize: =>
@$('.component').each((idx, element) =>
new CMS.Views.ModuleEdit(
el: element,
onDelete: @deleteTab,
model: new CMS.Models.Module(
id: $(element).data('id'),
)
)
)
@$('.components').sortable(
handle: '.drag-handle'
update: (event, ui) => alert 'got it!'
helper: 'clone'
opacity: '0.5'
placeholder: 'component-placeholder'
forcePlaceholderSize: true
axis: 'y'
items: '> .component'
)
addNewTab: (event) =>
event.preventDefault()
editor = new CMS.Views.ModuleEdit(
onDelete: @deleteTab
model: new CMS.Models.Module()
)
$('.new-component-item').before(editor.$el)
editor.cloneTemplate(
@model.get('id'),
'i4x://edx/templates/static_tab/Empty'
)
deleteTab: (event) =>
if not confirm 'Are you sure you want to delete this component? This action cannot be undone.'
return
$component = $(event.currentTarget).parents('.component')
$.post('/delete_item', {
id: $component.data('id')
}, =>
$component.remove()
)
<%inherit file="base.html" />
<%! from django.core.urlresolvers import reverse %>
<%block name="title">Tabs</%block>
<%block name="bodyclass">static-pages</%block>
<%block name="jsextra">
<script type='text/javascript'>
new CMS.Views.TabsEdit({
el: $('.main-wrapper'),
model: new CMS.Models.Module({
id: '${context_course.location}'
})
});
</script>
</%block>
<%block name="content">
<div class="main-wrapper">
<div class="inner-wrapper">
<h1>Static Tabs</h1>
<div class="main-column">
<article class="unit-body window">
<div class="tab-list">
<ol class='components'>
% for id in components:
<li class="component" data-id="${id}"/>
% endfor
<li class="new-component-item">
<a href="#" class="new-component-button new-tab">
<span class="plus-icon"></span>New Tab
</a>
</li>
</ol>
</div>
</article>
</div>
</div>
</div>
</%block>
\ No newline at end of file
---
metadata:
display_name: Empty
data: "This is where you can add additional information about your course."
children: []
\ No newline at end of file
---
metadata:
display_name: Empty
data: "This is where you can add additional information about your course."
children: []
\ No newline at end of file
---
metadata:
display_name: Empty
data: "This is where you can add additional pages to your courseware. Click the 'edit' button to begin editing."
children: []
\ No newline at end of file
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