also update default_project_name

New actions are created with the project as defined in
default_project_name. This value needs to be updated as shown in #1789.
This commit is contained in:
Carsten Otto 2015-04-13 22:15:39 +02:00
parent ae4ce272ff
commit f8f7762b94
5 changed files with 14 additions and 8 deletions

View file

@ -13,9 +13,6 @@ var TracksForm = {
}
toggleLink.parent().toggleClass('hide_form');
},
set_project_name: function (name) {
$('input#todo_project_name').val(name);
},
set_project_name_for_multi_add: function (name) {
$('#multi_todo_project_name').val(name);
},
@ -30,9 +27,8 @@ var TracksForm = {
$('input[name=default_context_name]').val(name);
},
set_project_name_and_default_project_name: function (name) {
TracksForm.set_project_name('');
$('input#todo_project_name').val(name);
$('#default_project_name_id').val(name);
$('#project_name').html(name);
},
set_tag_list_and_default_tag_list: function (name) {
$('input#tag_list').val(name);

View file

@ -34,7 +34,7 @@ var <%=object_name%> = {
update_project_page: function() {
<%=object_name%>.remove_project_edit_form();
<%=object_name%>.update_and_show_project_settings();
TracksForm.set_project_name("<%= escape_javascript(@project.name)%>");
TracksForm.set_project_name_and_default_project_name("<%= escape_javascript(@project.name)%>");
$("h2 span#project_name").html("<%= escape_javascript(@project.name)%>");
<% if @project.default_context %>
TracksForm.set_context_name_and_default_context_name("<%= escape_javascript(@project.default_context.name)%>");

View file

@ -1,4 +1,4 @@
<% if @saved -%>
TracksPages.page_inform('<%=t('projects.status_project_name_changed')%>');
TracksForm.set_project_name("<%= escape_javascript(@project.name)%>");
TracksForm.set_project_name_and_default_project_name("<%= escape_javascript(@project.name)%>");
<% end %>

View file

@ -28,7 +28,7 @@
$('#todo-form-new-action').clearForm();
$('#todo-form-new-action').clearDeps();
TracksForm.set_context_name('<%=escape_javascript @initial_context_name%>');
TracksForm.set_project_name('<%=escape_javascript @initial_project_name%>');
TracksForm.set_project_name_and_default_project_name('<%=escape_javascript @initial_project_name%>');
TracksForm.set_tag_list_and_default_tag_list('<%=escape_javascript @initial_tags%>');
$('#todo-form-new-action input:text:first').focus();
$('#new_todo_starred_link .todo_star').removeClass('starred');

View file

@ -58,6 +58,16 @@ Feature: Edit a project
Then the project title should be "cherries"
And the project field of the new todo form should contain "cherries"
# Ticket #1789
@javascript
Scenario: I can change the name of the project and it should still allow me to add new actions
Given I have a project "bananas"
When I go to the "bananas" project
And I edit the project name to "cherries"
And I edit the default context to "@pc"
And I submit a new action with description "a new next action"
Then I should see the todo "a new next action"
@javascript
Scenario: I can change the default context of the project and it should update the new todo form
Given I have a project "bananas" with 1 todos