diff --git a/cms/static/coffee/src/views/tabs.coffee b/cms/static/coffee/src/views/tabs.coffee new file mode 100644 index 0000000000..9797b9495b --- /dev/null +++ b/cms/static/coffee/src/views/tabs.coffee @@ -0,0 +1,54 @@ +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() + ) + + + + diff --git a/cms/templates/edit-tabs.html b/cms/templates/edit-tabs.html new file mode 100644 index 0000000000..7c4fc57ec2 --- /dev/null +++ b/cms/templates/edit-tabs.html @@ -0,0 +1,40 @@ +<%inherit file="base.html" /> +<%! from django.core.urlresolvers import reverse %> +<%block name="title">Tabs +<%block name="bodyclass">static-pages + +<%block name="jsextra"> + + + +<%block name="content"> +
+
+

Static Tabs

+
+
+
+
    + % for id in components: +
  1. + % endfor + +
  2. + + New Tab + +
  3. +
+
+
+
+
+
+ \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/templates/about/empty.yaml b/common/lib/xmodule/xmodule/templates/about/empty.yaml new file mode 100644 index 0000000000..71bcef8914 --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/about/empty.yaml @@ -0,0 +1,5 @@ +--- +metadata: + display_name: Empty +data: "This is where you can add additional information about your course." +children: [] \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/templates/courseinfo/empty.yaml b/common/lib/xmodule/xmodule/templates/courseinfo/empty.yaml new file mode 100644 index 0000000000..71bcef8914 --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/courseinfo/empty.yaml @@ -0,0 +1,5 @@ +--- +metadata: + display_name: Empty +data: "This is where you can add additional information about your course." +children: [] \ No newline at end of file diff --git a/common/lib/xmodule/xmodule/templates/statictab/empty.yaml b/common/lib/xmodule/xmodule/templates/statictab/empty.yaml new file mode 100644 index 0000000000..31306e2ce6 --- /dev/null +++ b/common/lib/xmodule/xmodule/templates/statictab/empty.yaml @@ -0,0 +1,5 @@ +--- +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