Commit b344e400 authored by Nigel McNie's avatar Nigel McNie
Browse files

Make the cancel button work for all blocks when being configured

parent 8d08b8a3
......@@ -230,14 +230,14 @@ function ViewManager() {
pd[getNodeAttribute(e.src(), 'name')] = 1;
sendjsonrequest('blocks.json.php', pd, 'POST', function(data) {
var blockinstance = getFirstParentByTagAndClassName(button, 'div', 'blockinstance');
var blockinstanceId = blockinstance.id.substr(blockinstance.id.lastIndexOf('_') + 1);
var content = getFirstElementByTagAndClassName('div', 'blockinstance-content', blockinstance);
var oldContent = content.innerHTML;
content.innerHTML = data.data['html'];
eval(data.data['js']);
// Make the cancel button be supersmart
// TODO fix the id of the cancel button
var cancelButton = $('cancel_cb_8_action_configureblockinstance_id_8');
var cancelButton = $('cancel_cb_' + blockinstanceId + '_action_configureblockinstance_id_' + blockinstanceId);
connect(cancelButton, 'onclick', function(e) {
e.stop();
content.innerHTML = oldContent;
......
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