diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b7646378..fbbcb8f2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -129,30 +129,6 @@ module ApplicationHelper {:id => "link_edit_#{dom_id(note)}", :class => "note_edit_settings"}) end - def link_to_delete_project(project, descriptor = sanitize(project.name)) - link_to( - descriptor, - project_path(project, :format => 'js'), - {:id => "delete_project_#{project.id}", :class => "delete_project_button", :title => "#{t('projects.delete_project_title')} '#{project.name}'"} - ) - end - - def link_to_delete_context(context, descriptor = sanitize(context.name)) - link_to( - descriptor, - context_path(context, :format => 'js'), - {:id => "delete_context_#{context.id}", :class => "delete_context_button", :title => t('contexts.delete_context_confirmation', :name => context.name)} - ) - end - - def link_to_delete_note(note, descriptor = sanitize(note.id.to_s)) - link_to( - descriptor, - note_path(note, :format => 'js'), - {:id => "delete_note_#{note.id}", :class => "delete_note_button", :title => "delete the note '#{note.id}'"} - ) - end - def link_to_project_mobile(project, accesskey, descriptor = sanitize(project.name)) link_to( descriptor, project_path(project, :format => 'm'), {:title => "View project: #{project.name}", :accesskey => accesskey} ) end @@ -263,4 +239,24 @@ module ApplicationHelper end end + def generate_i18n_strings + js = "" + js << "i18n = new Array();\n" + %w{ + shared.toggle_multi shared.toggle_multi_title + shared.hide_form shared.hide_action_form_title + shared.toggle_single shared.toggle_single_title + projects.hide_form projects.hide_form_title + projects.show_form projects.show_form_title + contexts.hide_form contexts.hide_form_title + contexts.show_form contexts.show_form_title + contexts.new_context_pre contexts.new_context_post + common.cancel common.ok + common.ajaxError + }.each do |s| + js << "i18n['#{s}'] = \"#{t(s)}\";\n" + end + return js + end + end diff --git a/app/helpers/contexts_helper.rb b/app/helpers/contexts_helper.rb index abe5299b..16058ff0 100644 --- a/app/helpers/contexts_helper.rb +++ b/app/helpers/contexts_helper.rb @@ -9,4 +9,17 @@ module ContextsHelper } end + def link_to_delete_context(context, descriptor = sanitize(context.name)) + link_to( + descriptor, + context_path(context, :format => 'js'), + { + :id => "delete_context_#{context.id}", + :class => "delete_context_button", + :x_confirm_message => t('contexts.delete_context_confirmation', :name => context.name), + :title => t('contexts.delete_context_title') + } + ) + end + end diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb index 1c3d51c0..b5a416f0 100644 --- a/app/helpers/notes_helper.rb +++ b/app/helpers/notes_helper.rb @@ -6,4 +6,14 @@ module NotesHelper def rendered_note(note) sanitize(textilize_without_paragraph(note.body)) end + + def link_to_delete_note(note, descriptor = sanitize(note.id.to_s)) + link_to( + descriptor, + note_path(note, :format => 'js'), + {:id => "delete_note_#{note.id}", :class => "delete_note_button", + :title => t('notes.delete_note_title', :id => note.id), :x_confirm_message => t('notes.delete_note_confirm', :id => note.id)} + ) + end + end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index c0a6640d..587ea435 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -44,5 +44,18 @@ module ProjectsHelper end html end + + def link_to_delete_project(project, descriptor = sanitize(project.name)) + link_to( + descriptor, + project_path(project, :format => 'js'), + { + :id => "delete_project_#{project.id}", + :class => "delete_project_button", + :x_confirm_message => t('projects.delete_project_confirmation', :name => project.name), + :title => t('projects.delete_project_title') + } + ) + end end diff --git a/app/helpers/recurring_todos_helper.rb b/app/helpers/recurring_todos_helper.rb index 53bd6c71..9bc0d04f 100644 --- a/app/helpers/recurring_todos_helper.rb +++ b/app/helpers/recurring_todos_helper.rb @@ -13,7 +13,7 @@ module RecurringTodosHelper def recurring_todo_remote_delete_icon link_to( image_tag_for_delete, recurring_todo_path(@recurring_todo), :id => "delete_icon_"+@recurring_todo.id.to_s, - :class => "icon delete_icon", :title => t('todos.delete_recurring_action', :description => @recurring_todo.description)) + :class => "icon delete_icon", :title => t('todos.delete_recurring_action_title'), :x_confirm_message => t('todos.delete_recurring_action_confirm', :description => @recurring_todo.description)) end def recurring_todo_remote_star_icon diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index b2ef5772..7f7bbc4d 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -20,7 +20,8 @@ module TodosHelper {:controller => 'todos', :action => 'destroy', :id => todo.id}, :class => "icon_delete_item", :id => "delete_#{dom_id(todo)}", - :title => t('todos.confirm_delete', :description => todo.description)); + :x_confirm_message => t('todos.confirm_delete', :description => todo.description), + :title => t('todos.delete_action')); end def remote_defer_menu_item(days, todo) diff --git a/app/views/contexts/_new_context_form.rhtml b/app/views/contexts/_new_context_form.rhtml index 1ce509ea..26bde0ba 100644 --- a/app/views/contexts/_new_context_form.rhtml +++ b/app/views/contexts/_new_context_form.rhtml @@ -1,7 +1,7 @@
-
- « <%= t('contexts.hide_form') %> +
diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb index b621f1a6..dccd68b9 100644 --- a/app/views/layouts/standard.html.erb +++ b/app/views/layouts/standard.html.erb @@ -27,6 +27,7 @@ setup_periodic_check("<%=url_for(:controller => "login", :action => "check_expiry")%>", 5*60); <% end -%> setup_periodic_check("<%=check_deferred_todos_path(:format => 'js')%>", 10*60, 'POST'); + <%= generate_i18n_strings %> <%= auto_discovery_link_tag(:rss, {:controller => "todos", :action => "index", :format => 'rss', :token => "#{current_user.token}"}, {:title => t('layouts.next_actions_rss_feed')}) %> diff --git a/app/views/projects/_new_project_form.rhtml b/app/views/projects/_new_project_form.rhtml index 1790fb65..1ed8808c 100644 --- a/app/views/projects/_new_project_form.rhtml +++ b/app/views/projects/_new_project_form.rhtml @@ -1,7 +1,7 @@
diff --git a/app/views/projects/_project_listing.rhtml b/app/views/projects/_project_listing.rhtml index d185dc63..7f84add5 100644 --- a/app/views/projects/_project_listing.rhtml +++ b/app/views/projects/_project_listing.rhtml @@ -18,7 +18,7 @@ suppress_edit_button ||= false
<%= project.current_state.to_s.upcase %> - <%= link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project'), :class=>"delete_item")) %> + <%= link_to_delete_project(project, image_tag( "blank.png", :title => t('projects.delete_project_title'), :class=>"delete_item")) %> <%= suppress_edit_button ? "" : link_to_edit_project(project, image_tag( "blank.png", :title => t('projects.edit_project_title'), :class=>"edit_item")) %>
diff --git a/app/views/projects/_project_state_group.rhtml b/app/views/projects/_project_state_group.rhtml index 3fac0052..9ac672fb 100644 --- a/app/views/projects/_project_state_group.rhtml +++ b/app/views/projects/_project_state_group.rhtml @@ -3,10 +3,10 @@ diff --git a/app/views/shared/_add_new_item_form.rhtml b/app/views/shared/_add_new_item_form.rhtml index 041163c7..455f3e16 100644 --- a/app/views/shared/_add_new_item_form.rhtml +++ b/app/views/shared/_add_new_item_form.rhtml @@ -7,7 +7,7 @@
diff --git a/config/locales/en.yml b/config/locales/en.yml index ac2e0f3d..28c1e8f6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -38,6 +38,7 @@ en: update: "Update" logout: "Logout" cancel: "Cancel" + ok: "Ok" project: "Project" projects: "Projects" context: "Context" @@ -55,12 +56,15 @@ en: description: "Description" notes: "Notes" optional: "optional" + ajaxError: 'There was an error retrieving from server' sort: sort: "Sort" alphabetically: "Alphabetically" alphabetically_title: "Sort projects alphabetically" + alphabetically_confirm: "Are you sure that you want to sort these projects alphabetically? This will replace the existing sort order." by_task_count: "By number of tasks" by_task_count_title: "Sort by number of tasks" + by_task_count_title_confirm: "Are you sure that you want to sort these projects by the number of tasks? This will replace the existing sort order." drag_handle: "DRAG" contexts: status_hidden: "Context is hidden" @@ -73,14 +77,19 @@ en: add_context: "Add Context" context_hide: "Hide from front page?" hide_form: "Hide form" + hide_form_title: "Hide new context form" + show_form: "Create a new context" + show_form_title: "Add a context" visible_contexts: "Visible contexts" hidden_contexts: "Hidden contexts" context_deleted: "Deleted context '%{name}'" no_contexts_hidden: "Currently there are no hidden contexts" no_contexts_active: "Currently there are no active contexts" - hide_form_link_title: "Hide new context form" delete_context: "Delete context" + delete_context_title: "Delete context" delete_context_confirmation: "Are you sure that you want to delete the context '%{name}'? Be aware that this will also delete all (repeating) actions in this context!" + new_context_pre: "New context '" + new_context_post: "' will be also created. Are you sure?" edit_context: "Edit context" data: import_errors: "Some errors occurred during import" @@ -194,6 +203,8 @@ en: delete_item_title: "Delete item" show_note_title: "Show note" deleted_note: "Deleted note '%{id}'" + delete_note_title: "Delete the note '%{id}'" + delete_note_confirm: "Are you sure that you want to delete the note '%{id}'?" no_notes_available: "Currently there are no notes: add notes to projects from individual project pages." preferences: title: "Your preferences" @@ -241,11 +252,14 @@ en: default_context: "The default context for this project is %{context}" project_state: "Project is %{state}." no_projects: "Currently there are no projects" - hide_new_project_form: "Hide new project form" + hide_form_title: "Hide new project form" hide_form: "Hide form" + show_form_title: "Create a new project" + show_form: "Add a project" add_project: "Add Project" to_new_project_page: "Take me to the new project page" - delete_project_title: "delete the project" + delete_project_title: "Delete the project" + delete_project_confirmation: "Are you sure that you want to delete the project '%{name}'?" delete_project: "Delete project" edit_project_title: "Edit project" states: @@ -269,6 +283,8 @@ en: hide_form: "Hide form" toggle_multi_title: "Toggle single/multi new action form" toggle_multi: "Add multiple next actions" + toggle_single: 'Add a next action' + toggle_single_title: 'Add a new next action' separate_tags_with_commas: "separate with commas" add_action: "Add action" multiple_next_actions: "Multiple next actions (one on each line)" @@ -429,7 +445,8 @@ en: show_option_always: "always" show_days_before: "%{days} days before the todo is due" from_tickler: "the date todo comes from tickler (no due date set)" - delete_recurring_action: "delete the recurring action '%{description}'" + delete_recurring_action_confirm: "Are you sure that you want to delete the recurring action '%{description}'?" + delete_recurring_action_title: "Delete the recurring action" star_action_with_description: "star the action '%{description}'" star_action: "Star this action" delete_action: "Delete action" diff --git a/features/context_list.feature b/features/context_list.feature index eef1fe1e..a1c3afa8 100644 --- a/features/context_list.feature +++ b/features/context_list.feature @@ -80,3 +80,12 @@ Feature: Manage the list of contexts Scenario: I can drag and drop to order the contexts # TODO: pending scenario Given this is a pending scenario + + @selenium @wip + Scenario: Hiding and unhiding the new project form + When I go to the contexts page + Then the new context form should be visible + When I follow "Hide form" + Then the new context form should not be visible + When I follow "Create a new context" + Then the new context form should be visible diff --git a/features/edit_a_todo.feature b/features/edit_a_todo.feature index ddfb5df2..96b657a4 100644 --- a/features/edit_a_todo.feature +++ b/features/edit_a_todo.feature @@ -12,8 +12,13 @@ Feature: Edit a next action from every page Scenario: I can toggle the star of a todo Given this is a pending scenario + @selenium @wip Scenario: I can delete a todo - Given this is a pending scenario + Given I have a todo with description "delete me" in the context "@home" + When I go to the home page + Then I should see "delete me" + And I delete the todo + Then I should not see "delete me" Scenario: Removing the last todo in context will hide context # delete, edit Given this is a pending scenario diff --git a/features/project_list.feature b/features/project_list.feature index 397b0d4f..e682797b 100644 --- a/features/project_list.feature +++ b/features/project_list.feature @@ -72,9 +72,9 @@ Feature: Manage the list of projects Scenario: Hiding and unhiding the new project form When I go to the projects page Then the new project form should be visible - When I follow "« Hide form" + When I follow "Hide form" Then the new project form should not be visible - When I follow "Create a new project »" + When I follow "Create a new project" Then the new project form should be visible @selenium diff --git a/features/shared_add_new_todo.feature b/features/shared_add_new_todo.feature index 0d7a8438..99caa94d 100644 --- a/features/shared_add_new_todo.feature +++ b/features/shared_add_new_todo.feature @@ -15,7 +15,7 @@ Feature: Add new next action from every page Scenario Outline: I can hide the input form for single next action on a page When I the Then the single action form should be visible - When I follow "« Hide form" + When I follow "Hide form" Then the single action form should not be visible Scenarios: @@ -32,7 +32,7 @@ Feature: Add new next action from every page Then the single action form should be visible When I follow "Add multiple next actions" Then the multiple action form should be visible - When I follow "« Hide form" + When I follow "Hide form" Then the single action form should not be visible And the multiple action form should not be visible @@ -48,11 +48,11 @@ Feature: Add new next action from every page Scenario Outline: I can hide the input form and then choose both input forms When I the Then the single action form should be visible - When I follow "« Hide form" + When I follow "Hide form" Then the single action form should not be visible When I follow "Add multiple next actions" Then the multiple action form should be visible - When I follow "« Hide form" + When I follow "Hide form" Then the single action form should not be visible And the multiple action form should not be visible @@ -71,7 +71,7 @@ Feature: Add new next action from every page When I follow "Add multiple next actions" Then the single action form should not be visible And the multiple action form should be visible - When I follow "Add single next action" + When I follow "Add a next action" Then the single action form should be visible And the multiple action form should not be visible diff --git a/features/step_definitions/context_steps.rb b/features/step_definitions/context_steps.rb index c73ad3bf..5a7dfbfa 100644 --- a/features/step_definitions/context_steps.rb +++ b/features/step_definitions/context_steps.rb @@ -61,7 +61,7 @@ end When /^I edit the context name in place to be "([^\"]*)"$/ do |new_context_name| selenium.click "context_name" fill_in "value", :with => new_context_name - click_button "OK" + click_button "Ok" end Then /^I should see the context name is "([^\"]*)"$/ do |context_name| diff --git a/features/step_definitions/project_steps.rb b/features/step_definitions/project_steps.rb index 49999645..b01ce894 100644 --- a/features/step_definitions/project_steps.rb +++ b/features/step_definitions/project_steps.rb @@ -104,7 +104,7 @@ end When /^I edit the project name in place to be "([^"]*)"$/ do |new_project_name| selenium.click "project_name" fill_in "value", :with => new_project_name - click_button "OK" + click_button "Ok" end When /^I edit the project state of "([^"]*)" to "([^"]*)"$/ do |project_name, state_name| diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index aad984e0..a848fad8 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -243,7 +243,7 @@ Then /^the container for the context "([^"]*)" should not be visible$/ do |conte 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?" + selenium.get_confirmation.should == "New context '#{context_name}' will be also created. Are you sure?" end Then /^I should see "([^"]*)" in the deferred container$/ do |todo_description| diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 24ba3393..82d6575e 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -8,7 +8,7 @@ var TracksForm = { toggleLink.text(showLinkText).attr('title', showLinkTitle); } else { - toggleLidefault_ajax_optionsnk.text(hideLinkText).attr('title', hideLinkTitle); + toggleLink.text(hideLinkText).attr('title', hideLinkTitle); $('#'+formId+' input:text:first').focus(); } toggleLink.parent().toggleClass('hide_form'); @@ -46,12 +46,12 @@ var TracksForm = { if ($("#todo_multi_add").is(':visible')) { /* hide multi next action form first */ $('#todo_new_action').show(); $('#todo_multi_add').hide(); - $('a#toggle_multi').text("Add multiple next actions"); + $('a#toggle_multi').text(i18n['shared.toggle_multi']); } TracksForm.toggle('toggle_action_new', 'todo_new_action', 'todo-form-new-action', - '« Hide form', 'Hide next action form', - 'Add a next action »', 'Add a next action'); + i18n['shared.hide_form'], i18n['shared.hide_action_form_title'], + i18n['shared.toggle_single'], i18n['shared.toggle_single_title']); }); /* toggle new todo form for multi edit */ @@ -59,13 +59,13 @@ var TracksForm = { if ($("#todo_multi_add").is(':visible')) { $('#todo_new_action').show(); $('#todo_multi_add').hide(); - $('a#toggle_multi').text("Add multiple next actions"); + $('a#toggle_multi').text(i18n['shared.toggle_multi']); } else { $('#todo_new_action').hide(); $('#todo_multi_add').show(); - $('a#toggle_multi').text("Add single next action"); - $('a#toggle_action_new').text('« Hide form'); + $('a#toggle_multi').text(i18n['shared.toggle_single']); + $('a#toggle_action_new').text(i18n['shared.hide_form']); } }); @@ -74,14 +74,15 @@ var TracksForm = { $(this).prev().val(''); }); - /* behavior for delete icon */ + /* behavior for delete icon. DEAD CODE??? */ $('.item-container a.delete_icon').live('click', function(evt){ evt.preventDefault(); params = {}; if(typeof(TAG_NAME) !== 'undefined'){ params._tag_name = TAG_NAME; } - if(confirm("Are you sure that you want to "+this.title+"?")){ + confirm_message = $(this).attr("x_confirm_message") + if(confirm(confirm_message)){ itemContainer = $(this).parents(".item-container"); itemContainer.block({ message: null @@ -93,7 +94,7 @@ var TracksForm = { } }); - /* behavior for edit icon */ + /* behavior for edit icon DEAD CODE???*/ $('.item-container a.edit_icon').live('click', function(evt){ evt.preventDefault(); params = {}; @@ -318,7 +319,7 @@ var TodoItems = { for (i=0; i