diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py
index a87520ab13..da85d99dcb 100644
--- a/cms/djangoapps/contentstore/views.py
+++ b/cms/djangoapps/contentstore/views.py
@@ -1,6 +1,7 @@
from mitxmako.shortcuts import render_to_response
from keystore.django import keystore
from django.contrib.auth.decorators import login_required
+from django.http import HttpResponse
def index(request):
@@ -11,3 +12,9 @@ def index(request):
course = keystore().get_item(['i4x', org, course, 'Course', name])
weeks = course.get_children()
return render_to_response('index.html', {'weeks': weeks})
+
+
+def edit_item(request):
+ item_id = request.GET['id']
+ item = keystore().get_item(item_id)
+ return HttpResponse("")
diff --git a/cms/envs/common.py b/cms/envs/common.py
index 20d49b7ac5..2fdc3fa6a4 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -155,6 +155,10 @@ PIPELINE_CSS = {
PIPELINE_ALWAYS_RECOMPILE = ['sass/base-style.scss']
PIPELINE_JS = {
+ 'main': {
+ 'source_filenames': ['coffee/main.coffee'],
+ 'output_filename': 'js/main.js',
+ },
}
PIPELINE_COMPILERS = [
diff --git a/cms/static/coffee/.gitignore b/cms/static/coffee/.gitignore
new file mode 100644
index 0000000000..a6c7c2852d
--- /dev/null
+++ b/cms/static/coffee/.gitignore
@@ -0,0 +1 @@
+*.js
diff --git a/cms/static/coffee/main.coffee b/cms/static/coffee/main.coffee
new file mode 100644
index 0000000000..e2d26d9a7e
--- /dev/null
+++ b/cms/static/coffee/main.coffee
@@ -0,0 +1,67 @@
+$ ->
+ $('section.main-content').children().hide()
+ $('.editable').inlineEdit()
+ $('.editable-textarea').inlineEdit({control: 'textarea'})
+
+ heighest = 0
+ $('.cal ol > li').each ->
+ heighest = if $(this).height() > heighest then $(this).height() else heighest
+
+ $('.cal ol > li').css('height',heighest + 'px')
+
+ $('.add-new-section').click -> return false
+
+ $('.new-week .close').click ->
+ $(this).parents('.new-week').hide()
+ $('p.add-new-week').show()
+ return false
+
+ $('.save-update').click ->
+ $(this).parent().parent().hide()
+ return false
+
+ edit_item = (id) ->
+ $.get('/edit_item', {id: id}, (data) ->
+ $('section.edit-pane').empty().append(data)
+ $('section.edit-pane').show()
+ )
+
+ setHeight = ->
+ windowHeight = $(this).height()
+ contentHeight = windowHeight - 29
+
+ $('section.main-content > section').css('min-height', contentHeight)
+ $('body.content .cal').css('height', contentHeight)
+
+ $('.edit-week').click ->
+ $('body').addClass('content')
+ $('body.content .cal').css('height', contentHeight)
+ $('section.edit-pane').show()
+ return false
+
+ $('a.week-edit').click ->
+ $('body').addClass('content')
+ $('body.content .cal').css('height', contentHeight)
+ $('section.edit-pane').show()
+ return false
+
+ $('a.sequence-edit').click ->
+ $('body').addClass('content')
+ $('body.content .cal').css('height', contentHeight)
+ $('section.edit-pane').show()
+ return false
+
+ $(document).ready(setHeight)
+ $(window).bind('resize', setHeight)
+
+ $('a.module-edit').click ->
+ edit_item($(this).attr('id'))
+ return false
+
+ $('.video-new a').click ->
+ $('section.edit-pane').show()
+ return false
+
+ $('.problem-new a').click ->
+ $('section.edit-pane').show()
+ return false
diff --git a/cms/static/js/main.js b/cms/static/js/main.js
deleted file mode 100644
index 2d72edc4bf..0000000000
--- a/cms/static/js/main.js
+++ /dev/null
@@ -1,85 +0,0 @@
-$(document).ready(function(){
- $('section.main-content').children().hide();
-
- $(function(){
- $('.editable').inlineEdit();
- $('.editable-textarea').inlineEdit({control: 'textarea'});
- });
-
- var heighest = 0;
- $('.cal ol > li').each(function(){
- heighest = ($(this).height() > heighest) ? $(this).height() : heighest;
-
- });
-
- $('.cal ol > li').css('height',heighest + 'px');
-
- $('.add-new-section').click(function() {
- return false;
- });
-
- $('.new-week .close').click( function(){
- $(this).parents('.new-week').hide();
- $('p.add-new-week').show();
- return false;
- });
-
- $('.save-update').click(function(){
- $(this).parent().parent().hide();
- return false;
- });
-
- setHeight = function(){
- var windowHeight = $(this).height();
- var contentHeight = windowHeight - 29;
-
- $('section.main-content > section').css('min-height', contentHeight);
- $('body.content .cal').css('height', contentHeight);
-
- $('.edit-week').click( function() {
- $('body').addClass('content');
- $('body.content .cal').css('height', contentHeight);
- $('section.week-new').show();
- return false;
- });
-
- $('.cal ol li header h1 a').click( function() {
- $('body').addClass('content');
- $('body.content .cal').css('height', contentHeight);
- $('section.week-edit').show();
- return false;
- });
-
- $('a.sequence-edit').click(function(){
- $('body').addClass('content');
- $('body.content .cal').css('height', contentHeight);
- $('section.sequence-edit').show();
- return false;
- });
- }
-
- $(document).ready(setHeight);
- $(window).bind('resize', setHeight);
-
- $('.video-new a').click(function(){
- $('section.video-new').show();
- return false;
- });
-
- $('a.video-edit').click(function(){
- $('section.video-edit').show();
- return false;
- });
-
- $('.problem-new a').click(function(){
- $('section.problem-new').show();
- return false;
- });
-
- $('a.problem-edit').click(function(){
- $('section.problem-edit').show();
- return false;
- });
-
-});
-
diff --git a/cms/templates/base.html b/cms/templates/base.html
index 271f73614d..2b56579bbb 100644
--- a/cms/templates/base.html
+++ b/cms/templates/base.html
@@ -26,7 +26,11 @@
+ % if settings.MITX_FEATURES['USE_DJANGO_PIPELINE']:
+ <%static:js group='main'/>
+ % else:
+ % endif
diff --git a/cms/templates/index.html b/cms/templates/index.html
index 11c226ae3d..2e2a8924e2 100644
--- a/cms/templates/index.html
+++ b/cms/templates/index.html
@@ -14,6 +14,7 @@
<%include file="widgets/video-new.html"/>
<%include file="widgets/problem-edit.html"/>
<%include file="widgets/problem-new.html"/>
+
diff --git a/cms/templates/widgets/navigation.html b/cms/templates/widgets/navigation.html
index 2d5af9ead1..3fbcda675c 100644
--- a/cms/templates/widgets/navigation.html
+++ b/cms/templates/widgets/navigation.html
@@ -38,7 +38,7 @@
% for week in weeks:
-
+
% if week.goals:
% for goal in week.goals:
@@ -53,7 +53,7 @@
% for module in week.get_children():
-
- ${module.name}
+ ${module.name}
handle
% endfor
diff --git a/cms/urls.py b/cms/urls.py
index d2e6415827..dad9528387 100644
--- a/cms/urls.py
+++ b/cms/urls.py
@@ -6,4 +6,5 @@ from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url(r'^$', 'contentstore.views.index', name='index'),
+ url(r'^edit_item$', 'contentstore.views.edit_item', name='edit_item'),
)
diff --git a/common/lib/xmodule/x_module.py b/common/lib/xmodule/x_module.py
index 9f960843d9..d424de1d0e 100644
--- a/common/lib/xmodule/x_module.py
+++ b/common/lib/xmodule/x_module.py
@@ -183,6 +183,7 @@ class XModuleDescriptor(Plugin):
self.definition = definition if definition is not None else {}
self.name = Location(kwargs.get('location')).name
self.type = Location(kwargs.get('location')).category
+ self.url = Location(kwargs.get('location')).url()
# For now, we represent goals as a list of strings, but this
# is one of the things that we are going to be iterating on heavily