Don't allow the project name to be edited in two places at once

When showing the project edit form, we disable the ability to edit the
project name in place. When the project edit form is saved or cancelled,
then we reenable the editing of the project name in place.

Fixes #1205
This commit is contained in:
Matt Rogers 2011-12-02 22:15:36 -06:00
parent a2df36cf71
commit 64cf5336c1
2 changed files with 3 additions and 0 deletions

View file

@ -11,6 +11,7 @@ function remove_edit_form() {
function show_edit_form() { function show_edit_form() {
$('div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form()); $('div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form());
$('div#<%=dom_id(@project, 'edit')%>').fadeIn(500); $('div#<%=dom_id(@project, 'edit')%>').fadeIn(500);
$('div#project_name').editable('disable');
} }
function set_focus() { function set_focus() {

View file

@ -776,12 +776,14 @@ var ProjectListPage = {
/* submit project form after edit */ /* submit project form after edit */
$("form.edit-project-form button.positive").live('click', function (ev) { $("form.edit-project-form button.positive").live('click', function (ev) {
$('div#project_name').editable('enable');
submit_with_ajax_and_block_element('form.edit-project-form', $(this)); submit_with_ajax_and_block_element('form.edit-project-form', $(this));
return false; return false;
}); });
/* cancel edit project form */ /* cancel edit project form */
$('form.edit-project-form a.negative').live('click', function(){ $('form.edit-project-form a.negative').live('click', function(){
$('div#project_name').editable('enable');
$(this).parents('.edit-form').fadeOut(200, function () { $(this).parents('.edit-form').fadeOut(200, function () {
$(this).parents('.list').find('.project').fadeIn(500); $(this).parents('.list').find('.project').fadeIn(500);
$(this).parents('.container').find('.item-show').fadeIn(500); $(this).parents('.container').find('.item-show').fadeIn(500);