From 51da342cdc4af9d6528eebbd483362894c2653af Mon Sep 17 00:00:00 2001 From: tim madden Date: Thu, 10 May 2012 13:53:01 -0500 Subject: [PATCH 1/2] harmonizing todo_tag_list and tag_list, using just the shorter tag_list --- app/assets/javascripts/tracks.js | 3 +-- app/assets/stylesheets/mobile.css | 2 +- app/controllers/todos_controller.rb | 6 +++--- app/views/todos/_edit_form.html.erb | 4 ++-- app/views/todos/_edit_form.m.erb | 4 ++-- app/views/todos/_new_todo_form.html.erb | 4 ++-- features/step_definitions/todo_create_steps.rb | 8 ++++---- features/step_definitions/todo_steps.rb | 6 +++--- test/functional/todos_controller_test.rb | 4 ++-- test/unit/todo_create_params_helper_test.rb | 4 ++-- 10 files changed, 22 insertions(+), 23 deletions(-) diff --git a/app/assets/javascripts/tracks.js b/app/assets/javascripts/tracks.js index 47a4a4be..8bb7e154 100644 --- a/app/assets/javascripts/tracks.js +++ b/app/assets/javascripts/tracks.js @@ -35,7 +35,7 @@ var TracksForm = { $('#project_name').html(name); }, set_tag_list: function (name) { - $('input#todo_tag_list').val(name); + $('input#tag_list').val(name); }, set_tag_list_for_multi_add: function (name) { $('#multi_tag_list').val(name); @@ -252,7 +252,6 @@ var TracksPages = { ContextItems.setup_autocomplete_for_contexts('input[name=context_name]'); ContextItems.setup_autocomplete_for_contexts('input[id="project_default_context_name"]'); TracksPages.setup_autocomplete_for_tag_list('input[name=tag_list]'); // todo edit form - TracksPages.setup_autocomplete_for_tag_list('input[name=todo_tag_list]'); // new todo form TracksPages.setup_autocomplete_for_tag_list('input[id="project_default_tags"]'); TodoItems.setup_autocomplete_for_predecessor(); }, diff --git a/app/assets/stylesheets/mobile.css b/app/assets/stylesheets/mobile.css index cf05eea6..33e0e1f6 100644 --- a/app/assets/stylesheets/mobile.css +++ b/app/assets/stylesheets/mobile.css @@ -230,7 +230,7 @@ table.c { display:inline; } -input#todo_description, input#todo_tag_list, textarea#todo_notes, select#todo_project_id, select#todo_context_id { +input#todo_description, input#tag_list, textarea#todo_notes, select#todo_project_id, select#todo_context_id { width: 95%; } diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 8660eae8..17eb5664 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -1269,8 +1269,8 @@ class TodosController < ApplicationController end def update_tags - if params[:todo_tag_list] - @todo.tag_with(params[:todo_tag_list]) + if params[:tag_list] + @todo.tag_with(params[:tag_list]) @todo.tags(true) #force a reload for proper rendering end end @@ -1423,7 +1423,7 @@ class TodosController < ApplicationController end def tag_list - @params['todo_tag_list'] + @params['tag_list'] end def predecessor_list diff --git a/app/views/todos/_edit_form.html.erb b/app/views/todos/_edit_form.html.erb index c0f8319a..c46548fc 100644 --- a/app/views/todos/_edit_form.html.erb +++ b/app/views/todos/_edit_form.html.erb @@ -30,8 +30,8 @@ - - <%= text_field_tag 'todo_tag_list', tag_list_text, :id => dom_id(@todo, 'todo_tag_list'), :size => 30, :tabindex => next_tab_index %> + + <%= text_field_tag 'tag_list', tag_list_text, :id => dom_id(@todo, 'tag_list'), :size => 30, :tabindex => next_tab_index %>
diff --git a/app/views/todos/_edit_form.m.erb b/app/views/todos/_edit_form.m.erb index 93b6fc0e..83e90d23 100644 --- a/app/views/todos/_edit_form.m.erb +++ b/app/views/todos/_edit_form.m.erb @@ -6,8 +6,8 @@ <% this_year = current_user.time.to_date.strftime("%Y").to_i -%>

<%= text_field( "todo", "description", "tabindex" => 1, "maxlength" => 100, "size" => 50) %> -

-<%= text_field_tag "todo_tag_list", @tag_list_text, :size => 50, :tabindex => 2 %> +

+<%= text_field_tag "tag_list", @tag_list_text, :size => 50, :tabindex => 2 %>

<%= unless @mobile_from_context collection_select( "todo", "context_id", @contexts, "id", "name", {}, {"tabindex" => 3} ) diff --git a/app/views/todos/_new_todo_form.html.erb b/app/views/todos/_new_todo_form.html.erb index 507b1980..4def4af2 100644 --- a/app/views/todos/_new_todo_form.html.erb +++ b/app/views/todos/_new_todo_form.html.erb @@ -30,9 +30,9 @@ - + <%= hidden_field_tag "initial_tag_list", @initial_tags%> - <%= text_field_tag "todo_tag_list", @initial_tags, :size => 30, :tabindex => next_tab_index %> + <%= text_field_tag "tag_list", @initial_tags, :size => 30, :tabindex => next_tab_index %> <%= content_tag("div", "", :id => "tag_list_auto_complete", :class => "auto_complete") %>
diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb index d3b560e5..d9391daf 100644 --- a/features/step_definitions/todo_create_steps.rb +++ b/features/step_definitions/todo_create_steps.rb @@ -215,7 +215,7 @@ end When /^I submit a new action with description "([^"]*)" and the tags "([^"]*)" in the context "([^"]*)"$/ do |description, tags, context_name| fill_in "todo[description]", :with => description - fill_in "todo_tag_list", :with => tags + fill_in "tag_list", :with => tags # fill_in does not seem to work when the field is prefilled with something. Empty the field first clear_context_name_from_next_action_form @@ -231,7 +231,7 @@ When /^I submit a new action with description "([^"]*)" to project "([^"]*)" wit fill_in "todo_project_name", :with => project_name fill_in "todo_context_name", :with => context_name - fill_in "todo_tag_list", :with => tags + fill_in "tag_list", :with => tags submit_next_action_form end @@ -263,7 +263,7 @@ When /^I submit a new deferred action with description "([^"]*)" and the tags "( clear_context_name_from_next_action_form fill_in "todo_context_name", :with => context_name - fill_in "todo_tag_list", :with => tags + fill_in "tag_list", :with => tags fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week) submit_next_action_form end @@ -276,7 +276,7 @@ When /^I submit a new deferred action with description "([^"]*)" to project "([^ fill_in "todo_project_name", :with => project_name fill_in "todo_context_name", :with => context_name - fill_in "todo_tag_list", :with => tags + fill_in "tag_list", :with => tags fill_in "todo[show_from]", :with => format_date(@current_user.time + 1.week) submit_next_action_form diff --git a/features/step_definitions/todo_steps.rb b/features/step_definitions/todo_steps.rb index 5e0c548f..aa0c5cf9 100644 --- a/features/step_definitions/todo_steps.rb +++ b/features/step_definitions/todo_steps.rb @@ -122,12 +122,12 @@ Then /^the default context of the new todo form should be "([^"]*)"$/ do |contex end Then /^the tag field in the new todo form should be empty$/ do - xpath= "//form[@id='todo-form-new-action']/input[@id='todo_tag_list']" + xpath= "//form[@id='todo-form-new-action']/input[@id='tag_list']" page.find(:xpath, xpath).value.blank?.should be_true end Then /^the tag field in the new todo form should be "([^"]*)"$/ do |tag_list| - xpath= "//form[@id='todo-form-new-action']/input[@id='todo_tag_list']" + xpath= "//form[@id='todo-form-new-action']/input[@id='tag_list']" tag_list.should == page.find(:xpath, xpath).value end @@ -161,4 +161,4 @@ Then /^I should (see|not see) the notes of "([^"]*)"$/ do |visible, todo_descrip todo.should_not be_nil page.find("div#notes_todo_#{todo.id}").send(visible=="see" ? "should" : "should_not", be_visible) -end \ No newline at end of file +end diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index 6cbae911..a9ffd45e 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -49,7 +49,7 @@ class TodosControllerTest < ActionController::TestCase assert_difference 'Todo.count' do put :create, :_source_view => 'todo', "context_name"=>"library", "project_name"=>"Build a working time machine", "todo"=>{ "notes"=>"", "description"=>"test tags", "due"=>"30/11/2006"}, - "todo_tag_list"=>"1234,5667,9876" + "tag_list"=>"1234,5667,9876" # default has_many_polymorphs will fail on these high numbers as tags with those id's do not exist end t = assigns['todo'] @@ -63,7 +63,7 @@ class TodosControllerTest < ActionController::TestCase assert_difference 'Todo.count' do put :create, :_source_view => 'todo', "context_name"=>"library", "project_name"=>"Build a working time machine", "todo"=>{ "notes"=>"", "description"=>"test tags", "due"=>"30/11/2006"}, - "todo_tag_list"=>"a,,b" + "tag_list"=>"a,,b" # default has_many_polymorphs will fail on the empty tag end t = assigns['todo'] diff --git a/test/unit/todo_create_params_helper_test.rb b/test/unit/todo_create_params_helper_test.rb index 7b981b88..3251150a 100644 --- a/test/unit/todo_create_params_helper_test.rb +++ b/test/unit/todo_create_params_helper_test.rb @@ -34,7 +34,7 @@ class TodoCreateParamsHelperTest < ActiveSupport::TestCase end def test_tag_list_accessor - params = { 'todo' => { }, 'todo_tag_list' => 'foo, bar'} + params = { 'todo' => { }, 'tag_list' => 'foo, bar'} prefs = users(:admin_user).prefs params_helper = TodosController::TodoCreateParamsHelper.new(params, prefs) assert_equal('foo, bar', params_helper.tag_list) @@ -133,4 +133,4 @@ class TodoCreateParamsHelperTest < ActiveSupport::TestCase assert_equal false, params_helper.context_specified_by_name? end -end \ No newline at end of file +end From a98f8be27983e02edefaa986895f5d9f1ecc8603 Mon Sep 17 00:00:00 2001 From: Tim Madden Date: Fri, 11 May 2012 22:46:28 -0500 Subject: [PATCH 2/2] fixing a broken i18n reference --- app/models/recurring_todo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/recurring_todo.rb b/app/models/recurring_todo.rb index 82d8e2d0..88f328a2 100644 --- a/app/models/recurring_todo.rb +++ b/app/models/recurring_todo.rb @@ -411,7 +411,7 @@ class RecurringTodo < ActiveRecord::Base return I18n.t("todos.recurrence.pattern.on_work_days") else if every_other1 > 1 - return I18n.t("todos.recurrence.pattern.every_n", :n => every_other1) + " " + I18n.t("common.days") + return I18n.t("todos.recurrence.pattern.every_n", :n => every_other1) + " " + I18n.t("common.days_midsentence.other") else return I18n.t("todos.recurrence.pattern.every_day") end