mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
harmonizing todo_tag_list and tag_list, using just the shorter tag_list
This commit is contained in:
parent
89f96da623
commit
51da342cdc
10 changed files with 22 additions and 23 deletions
|
|
@ -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();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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%;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
<input id="<%= dom_id(@todo, 'context_name') %>" name="context_name" autocomplete="off" tabindex="<%= next_tab_index%>" size="30" type="text" value="<%= h @todo.context.name %>" />
|
||||
</div>
|
||||
|
||||
<label class="tag_list_label" for="<%= dom_id(@todo, 'todo_tag_list') %>"><%= t('todos.tags') %></label>
|
||||
<%= text_field_tag 'todo_tag_list', tag_list_text, :id => dom_id(@todo, 'todo_tag_list'), :size => 30, :tabindex => next_tab_index %>
|
||||
<label class="tag_list_label" for="<%= dom_id(@todo, 'tag_list') %>"><%= t('todos.tags') %></label>
|
||||
<%= text_field_tag 'tag_list', tag_list_text, :id => dom_id(@todo, 'tag_list'), :size => 30, :tabindex => next_tab_index %>
|
||||
|
||||
<div class="due_input">
|
||||
<label for="<%= dom_id(@todo, 'due_label') %>"><%= Todo.human_attribute_name('due') %></label>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<% this_year = current_user.time.to_date.strftime("%Y").to_i -%>
|
||||
<h2><label for="todo_description"><%= t('common.description') %></label></h2>
|
||||
<%= text_field( "todo", "description", "tabindex" => 1, "maxlength" => 100, "size" => 50) %>
|
||||
<h2><label for="todo_tag_list"><%= t('todos.tags') %></label></h2>
|
||||
<%= text_field_tag "todo_tag_list", @tag_list_text, :size => 50, :tabindex => 2 %>
|
||||
<h2><label for="tag_list"><%= t('todos.tags') %></label></h2>
|
||||
<%= text_field_tag "tag_list", @tag_list_text, :size => 50, :tabindex => 2 %>
|
||||
<h2><label for="todo_context_id"><%= t('common.context') %></label></h2>
|
||||
<%= unless @mobile_from_context
|
||||
collection_select( "todo", "context_id", @contexts, "id", "name", {}, {"tabindex" => 3} )
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@
|
|||
<label for="todo_context_name"><%= Todo.human_attribute_name('context') %></label>
|
||||
<input id="todo_context_name" name="context_name" autocomplete="off" tabindex="<%= next_tab_index%>" size="30" type="text" value="<%= h(@initial_context_name) %>" />
|
||||
|
||||
<label for="todo_tag_list"><%= Todo.human_attribute_name('tags') + ' (' + t('shared.separate_tags_with_commas') + ')' %></label>
|
||||
<label for="tag_list"><%= Todo.human_attribute_name('tags') + ' (' + t('shared.separate_tags_with_commas') + ')' %></label>
|
||||
<%= 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") %>
|
||||
|
||||
<div class="due_input">
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -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
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue