Call js module name dynamically, rather than statically calling the HTML module

This commit is contained in:
Calen Pennington
2012-06-22 08:59:53 -04:00
parent 657fcd9984
commit 17a4d7fd09
6 changed files with 18 additions and 8 deletions

View File

@@ -17,4 +17,7 @@ def index(request):
def edit_item(request):
item_id = request.GET['id']
item = keystore().get_item(item_id)
return HttpResponse(item.get_html())
return render_to_response('unit.html', {
'contents': item.get_html(),
'type': item.type,
})

View File

@@ -9,7 +9,7 @@ edit_item = (id) ->
bind_edit_links()
$('section.edit-pane').show()
$('body').addClass('content')
window['construct_html']('module-html')
new window[$('#unit-wrapper').attr('class')] 'module-html'
)
$ ->

3
cms/templates/unit.html Normal file
View File

@@ -0,0 +1,3 @@
<div id="unit-wrapper" class="${type}">
${contents}
</div>