Skip to content

Commit

Permalink
Ensure that page parts get appended inside the correct element and cl…
Browse files Browse the repository at this point in the history
…ean up the dialog after closing it. Closes refineryGH-477
  • Loading branch information
parndt committed Feb 24, 2011
1 parent 57f222c commit e8eb5b5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions core/public/javascripts/refinery/admin.js
Expand Up @@ -676,34 +676,34 @@ var page_options = {
var tab_title = part_title.toLowerCase().replace(" ", "_");

if ($('#part_' + tab_title).size() === 0) {
$.get(page_options.new_part_url,
{
$.get(page_options.new_part_url, {
title: part_title
, part_index: $('#new_page_part_index').val()
, body: ''
}
, function(data, status){
}, function(data, status){
$('#submit_continue_button').remove();
// Add a new tab for the new content section.
$(data).appendTo('#page_part_editors');
page_options.tabs.tabs('add', '#page_part_new_' + $('#new_page_part_index').val(), part_title);
page_options.tabs.tabs('select', $('#new_page_part_index').val());

// turn the new textarea into a wymeditor.
$('#page_parts_attributes_' + $('#new_page_part_index').val() + "_body").wymeditor(wymeditor_boot_options);

// hook into wymedtior to instruct it to select this new tab again once it has loaded.
WYMeditor.onload_functions.push(function() {
$('#page_part_new_' + $('#new_page_part_index').val()).appendTo('#page_part_editors');
page_options.tabs.tabs('select', $('#new_page_part_index').val());
});

// turn the new textarea into a wymeditor.
WYMeditor.init();

// Wipe the title and increment the index counter by one.
$('#new_page_part_index').val(parseInt($('#new_page_part_index').val(), 10) + 1);
$('#new_page_part_title').val('');

page_options.tabs.find('> ul li a').corner('top 5px');

$('#new_page_part_dialog').dialog('close');
$('#new_page_part_dialog').remove();
}
);
}else{
Expand Down

0 comments on commit e8eb5b5

Please sign in to comment.