From 64cf5336c1d2168a0f49d347fda88c30985147f0 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 2 Dec 2011 22:15:36 -0600 Subject: [PATCH] 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 --- app/views/projects/edit.js.erb | 1 + public/javascripts/application.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/views/projects/edit.js.erb b/app/views/projects/edit.js.erb index e5c087ca..e4dd0736 100644 --- a/app/views/projects/edit.js.erb +++ b/app/views/projects/edit.js.erb @@ -11,6 +11,7 @@ function remove_edit_form() { function show_edit_form() { $('div#<%=dom_id(@project, 'edit')%>').html(html_for_edit_form()); $('div#<%=dom_id(@project, 'edit')%>').fadeIn(500); + $('div#project_name').editable('disable'); } function set_focus() { diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 447790cb..232ae12c 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -776,12 +776,14 @@ var ProjectListPage = { /* submit project form after edit */ $("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)); return false; }); /* cancel edit project form */ $('form.edit-project-form a.negative').live('click', function(){ + $('div#project_name').editable('enable'); $(this).parents('.edit-form').fadeOut(200, function () { $(this).parents('.list').find('.project').fadeIn(500); $(this).parents('.container').find('.item-show').fadeIn(500);