Commit 83b3d51f by Calen Pennington

Wire up the cancel button in the unit editor

parent 72eef72d
bind_edit_links = ->
$('a.module-edit').click ->
edit_item($(this).attr('id'))
return false
class @CMS
@bind = =>
$('a.module-edit').click ->
CMS.edit_item($(this).attr('id'))
return false
edit_item = (id) =>
$.get('/edit_item', {id: id}, (data) =>
$('#module-html').empty().append(data)
bind_edit_links()
$('section.edit-pane').show()
$('body').addClass('content')
new @Unit('unit-wrapper', id)
)
@edit_item = (id) =>
$.get('/edit_item', {id: id}, (data) =>
$('#module-html').empty().append(data)
CMS.bind()
$('section.edit-pane').show()
$('body').addClass('content')
new Unit('unit-wrapper', id)
)
$ ->
$.ajaxSetup
......@@ -73,5 +74,5 @@ $ ->
$('section.edit-pane').show()
return false
bind_edit_links()
CMS.bind()
......@@ -2,12 +2,14 @@ class @Unit
constructor: (@element_id, @module_id) ->
@module = new window[$("##{@element_id}").attr('class')] 'module-html'
$("##{@element_id} .save-update").click( (event) =>
$("##{@element_id} .save-update").click (event) =>
event.preventDefault()
$.post("save_item", {
id: @module_id
data: JSON.stringify(@module.save())
})
)
$("##{@element_id} .cancel").click (event) =>
event.preventDefault()
CMS.edit_item(@module_id)
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