Commit 0bdac5ef authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1635503: JSON editor - saving a copy only once

behatnotneeded

Change-Id: If4fe5c1eba980312bc46be03c3a54adf87f84de1
(cherry picked from commit a5e3533f)
parent 36a975e9
......@@ -195,12 +195,17 @@ if ($fw_to_edit) {
}
}
else {
$content->active = false;
$framework = new Framework(null, $content);
}
$framework->commit();
$framework->set_config_fields();
$data = $form_data['institution'];
$data['id'] = $framework->get('id');
$data['institution'] = $form_data['institution'];
$data['name'] = $framework->get('name');
$message = get_string('successmessage', 'module.framework');
json_reply(false, (object) array('message' => $message, 'data' => $data));
......@@ -140,7 +140,18 @@ jQuery(function($) {
json_form.fw_id = fw_id;
}
//save completed form data
sendjsonrequest(url, json_form, 'POST');
sendjsonrequest(url, json_form, 'POST', function(data) {
// get framework id for next save
fw_id = data.data.id;
// place the name of the framework in the "Edit" dropdown
$('select#edit').append($('<option>', {value:data.data.id, text:data.data.name}));
$('select#edit option').last().prop('selected', true);
edit = true;
// reset the "Copy" dropdown
$("#copy option:eq(0)").prop('selected', true);
});
window.scrollTo(0,0);
});//end of functionality implemented outside the editor
......
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