diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 4bfb43de..bd0ae8ca 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -124,12 +124,12 @@ class TodosController < ApplicationController @initial_context_name = params['default_context_name'] @initial_project_name = params['default_project_name'] @default_tags = @todo.project.default_tags unless @todo.project.nil? - @status_message = 'Added new next action' - @status_message += ' to tickler' if @todo.deferred? - @status_message += ' in pending state' if @todo.pending? - @status_message += ' in hidden state' if @todo.hidden? - @status_message = 'Added new project / ' + @status_message if @new_project_created - @status_message = 'Added new context / ' + @status_message if @new_context_created + @status_message = t('todos.added_new_next_action') + @status_message += ' ' + t('todos.to_tickler') if @todo.deferred? + @status_message += ' ' + t('todos.in_pending_state') if @todo.pending? + @status_message += ' ' + t('todos.in_hidden_state') if @todo.hidden? + @status_message = t('todos.added_new_project') + ' / ' + @status_message if @new_project_created + @status_message = t('todos.added_new_context') + ' / ' + @status_message if @new_context_created end render :action => 'create' end @@ -190,6 +190,11 @@ class TodosController < ApplicationController @saved = false; @default_tags = current_user.projects.find_by_name(@initial_project_name).default_tags unless @initial_project_name.blank? end + + @status_message = @todos.size > 1 ? t('todos.added_new_next_action_plural') : t('todos.added_new_next_action_singular') + @status_message = t('todos.added_new_project') + ' / ' + @status_message if @new_project_created + @status_message = t('todos.added_new_context') + ' / ' + @status_message if @new_context_created + render :action => 'create_multiple' end format.xml do diff --git a/app/views/projects/update.js.erb b/app/views/projects/update.js.erb index 58256c09..0b45527b 100644 --- a/app/views/projects/update.js.erb +++ b/app/views/projects/update.js.erb @@ -11,6 +11,10 @@ TracksPages.show_edit_errors(html_for_error_messages()); <% end %> +<% if @saved + # only add these js functions if the project is saved +-%> + function update_project_list_page() { <% if @state_changed -%> remove_and_re_add_project(); @@ -82,6 +86,9 @@ function html_for_project_settings() { return "<%= source_view_is(:project) ? escape_javascript(render(:partial => 'project_settings', :object => @project )) : "" %>"; } +<% end # if @saved +-%> + function html_for_error_messages() { return "<%= escape_javascript(error_messages_for('project')) %>"; } \ No newline at end of file diff --git a/app/views/todos/create_multiple.js.erb b/app/views/todos/create_multiple.js.erb index eb7b8a18..ac0b7877 100644 --- a/app/views/todos/create_multiple.js.erb +++ b/app/views/todos/create_multiple.js.erb @@ -21,13 +21,7 @@ -%> function set_notification() { - <%- - status_message = 'Added new next action' - status_message += 's' if @todos.size > 1 - status_message = 'Added new project / ' + status_message if @new_project_created - status_message = 'Added new context / ' + status_message if @new_context_created - -%> - TracksPages.page_notify('notice', "<%=status_message%>", 5); + TracksPages.page_notify('notice', "<%=@status_message%>", 5); } function clear_form() { diff --git a/app/views/todos/destroy.js.erb b/app/views/todos/destroy.js.erb index b4948a35..c511f172 100644 --- a/app/views/todos/destroy.js.erb +++ b/app/views/todos/destroy.js.erb @@ -49,10 +49,10 @@ function show_new_todo_if_todo_was_recurring() { TodoItemsContainer.ensureVisibleWithEffectAppear("<%=item_container_id(@new_recurring_todo)%>"); $('#<%=item_container_id(@new_recurring_todo)%>').append(html_for_new_recurring_todo()); $('#<%= dom_id(@new_recurring_todo, 'line')%>').effect('highlight', {}, 2000 ); - TracksPages.page_notify('notice', "Action was deleted. Because this action is recurring, a new action was added", 5); + TracksPages.page_notify('notice', "<%=t('todos.recurring_action_deleted')%>", 5); <% else -%> <% if @todo.recurring_todo.todos.active.count == 0 && @new_recurring_todo.nil? -%> - TracksPages.page_notify('notice', "There is no next action after the recurring action you just deleted. The recurrence is completed", 5); + TracksPages.page_notify('notice', "<%=t('todos.completed_recurrence_completed')%>", 5); <% end -%> <% end -%> <% end -%> @@ -75,5 +75,4 @@ function html_for_new_recurring_todo() { <% end # if @saved --%> ->>>>>>> get destroying of actions working +-%> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 69f0f7d9..15fbd337 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -528,8 +528,11 @@ en: completed_in_archive: "There are {{count}} completed actions in the archive." completed_more_than_x_days_ago: "Completed more than {{count}} days ago" added_new_next_action: "Added new next action" + added_new_next_action_singular: "Added new next action" + added_new_next_action_plural: "Added new next actions" to_tickler: "to tickler" in_pending_state: "in pending state" + in_hidden_state: "in hidden state" recurring_action_deleted: "Action was deleted. Because this action is recurring, a new action was added" completed_recurrence_completed: "There is no next action after the recurring action you just deleted. The recurrence is completed" error_deleting_item: "There was an error deleting the item {{description}}" diff --git a/features/manage_users.feature b/features/manage_users.feature index 67de4919..6a15b50b 100644 --- a/features/manage_users.feature +++ b/features/manage_users.feature @@ -17,7 +17,7 @@ Feature: Manage users Scenario: Add new account When I go to the manage users page - And I follow "Signup new user" + And I follow "Sign up new user" Then I should be on the signup page When I submit the signup form with username "new.user", password "secret123" and confirm with "secret123" Then I should be on the manage users page diff --git a/features/show_statistics.feature b/features/show_statistics.feature index 023072c5..7a74aeef 100644 --- a/features/show_statistics.feature +++ b/features/show_statistics.feature @@ -26,7 +26,7 @@ Feature: Show statistics And I should see "you have a total of 9 actions" And I should see "2 of these are completed" Then I should see "Totals" - And I should see "Actions" + And I should see "actions" And I should see "Contexts" And I should see "Projects" And I should see "Tags" diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb index c43f3bd3..c73ad3bf 100644 --- a/features/step_definitions/context_steps.rb +++ b/features/step_definitions/context_steps.rb @@ -74,9 +74,4 @@ end Then /^he should see that a context named "([^\"]*)" is not present$/ do |context_name| Then "I should not see \"#{context_name} (\"" -end - -Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type| - xpath= "//div[@id='feeds-for-#{list_type}']//strong" - name.should == response.selenium.get_text("xpath=#{xpath}") -end +end \ No newline at end of file diff --git a/features/step_definitions/feedlist_steps.rb b/features/step_definitions/feedlist_steps.rb index 90de4122..1715f36e 100644 --- a/features/step_definitions/feedlist_steps.rb +++ b/features/step_definitions/feedlist_steps.rb @@ -1,9 +1,9 @@ Then /^I should see a message that you need a context to get feeds for contexts$/ do - Then "I should see \"There need to be at least one context before you can request a feed\"" + Then "I should see \"There needs to be at least one context before you can request a feed\"" end Then /^I should see a message that you need a project to get feeds for projects$/ do - Then "I should see \"There need to be at least one project before you can request a feed\"" + Then "I should see \"There needs to be at least one project before you can request a feed\"" end Then /^I should see feeds for projects$/ do @@ -29,3 +29,9 @@ Then /^I should see "([^"]*)" as the selected context$/ do |context_name| scope.should have_selector("option[selected=\"selected\"]", :content => context_name) end end + +Then /^I should see feeds for "([^"]*)" in list of "([^"]*)"$/ do |name, list_type| + selenium.wait_for :wait_for => :ajax, :javascript_framework => :jquery + xpath= "//div[@id='feeds-for-#{list_type}']//strong" + name.should == response.selenium.get_text("xpath=#{xpath}") +end diff --git a/features/step_definitions/shared_new_todo_steps.rb b/features/step_definitions/shared_new_todo_steps.rb index d5f8468c..196a9904 100644 --- a/features/step_definitions/shared_new_todo_steps.rb +++ b/features/step_definitions/shared_new_todo_steps.rb @@ -12,5 +12,4 @@ end Then /^the multiple action form should not be visible$/ do selenium.is_visible("todo_multi_add").should == false -end - +end \ No newline at end of file diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index 4555ea90..557da9b3 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -236,4 +236,4 @@ end Then /^a confirmation for adding a new context "([^"]*)" should be asked$/ do |context_name| selenium.get_confirmation.should == "New context \"#{context_name}\" will be also created. Are you sure?" -end +end \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 15964d1e..4ab33189 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -513,7 +513,8 @@ var ContextListPage = { /* delete a context using the x button */ $('a.delete_context_button').live('click', function(evt){ - if(confirm("Are you sure that you want to "+this.title+"? Be aware that this will also delete all (repeating) actions in this context!")){ + /* TODO: move from this.title to this.x-messsage or something similar */ + if(confirm(this.title)){ delete_with_ajax_and_block_element(this.href, $(this).parents('.context')); } return false; diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index aeb075a1..87cc71ef 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -126,9 +126,9 @@ class TodosControllerTest < ActionController::TestCase def test_update_todo_to_deferred_is_reflected_in_badge_count login_as(:admin_user) get :index - assert_equal 10, assigns['count'] + assert_equal 11, assigns['count'] xhr :post, :update, :id => 1, :_source_view => 'todo', "context_name"=>"library", "project_name"=>"Make more money than Billy Gates", "todo"=>{"id"=>"1", "notes"=>"", "description"=>"Call Warren Buffet to find out how much he makes per day", "due"=>"30/11/2006", "show_from"=>"30/11/2030"}, "tag_list"=>"foo bar" - assert_equal 9, assigns['down_count'] + assert_equal 10, assigns['down_count'] end def test_update_todo @@ -313,7 +313,7 @@ class TodosControllerTest < ActionController::TestCase def test_mobile_index_assigns_down_count login_as(:admin_user) get :index, { :format => "m" } - assert_equal 10, assigns['down_count'] + assert_equal 11, assigns['down_count'] end def test_mobile_create_action_creates_a_new_todo