mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
fix several deprecation warnings
truncate wants explicit :length => number and :omission calling a partial from a js requires to explicitly pass the variable i.e. :todo => @todo instead of rails doing it implicitly
This commit is contained in:
parent
6da4282558
commit
198f3240b8
10 changed files with 27 additions and 27 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
module NotesHelper
|
module NotesHelper
|
||||||
def truncated_note(note, characters = 50)
|
def truncated_note(note, characters = 50)
|
||||||
sanitize(textilize_without_paragraph(truncate(note.body, characters, "...")))
|
sanitize(textilize_without_paragraph(truncate(note.body, :length => characters, :omission => "...")))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ module ProjectsHelper
|
||||||
def project_next_prev
|
def project_next_prev
|
||||||
html = ''
|
html = ''
|
||||||
unless @previous_project.nil?
|
unless @previous_project.nil?
|
||||||
project_name = truncate(@previous_project.name, 40, "...")
|
project_name = truncate(@previous_project.name, :length => 40, :omission => "...")
|
||||||
html << link_to_project(@previous_project, "« #{project_name}")
|
html << link_to_project(@previous_project, "« #{project_name}")
|
||||||
end
|
end
|
||||||
html << ' | ' if @previous_project && @next_project
|
html << ' | ' if @previous_project && @next_project
|
||||||
unless @next_project.nil?
|
unless @next_project.nil?
|
||||||
project_name = truncate(@next_project.name, 40, "...")
|
project_name = truncate(@next_project.name, :length => 40, :omission => "...")
|
||||||
html << link_to_project(@next_project, "#{project_name} »")
|
html << link_to_project(@next_project, "#{project_name} »")
|
||||||
end
|
end
|
||||||
html
|
html
|
||||||
|
|
@ -34,12 +34,12 @@ module ProjectsHelper
|
||||||
def project_next_prev_mobile
|
def project_next_prev_mobile
|
||||||
html = ''
|
html = ''
|
||||||
unless @previous_project.nil?
|
unless @previous_project.nil?
|
||||||
project_name = truncate(@previous_project.name, 40, "...")
|
project_name = truncate(@previous_project.name, :length => 40, :omission => "...")
|
||||||
html << link_to_project_mobile(@previous_project, "5", "« 5-#{project_name}")
|
html << link_to_project_mobile(@previous_project, "5", "« 5-#{project_name}")
|
||||||
end
|
end
|
||||||
html << ' | ' if @previous_project && @next_project
|
html << ' | ' if @previous_project && @next_project
|
||||||
unless @next_project.nil?
|
unless @next_project.nil?
|
||||||
project_name = truncate(@next_project.name, 40, "...")
|
project_name = truncate(@next_project.name, :length => 40, :omission => "...")
|
||||||
html << link_to_project_mobile(@next_project, "6", "6-#{project_name} »")
|
html << link_to_project_mobile(@next_project, "6", "6-#{project_name} »")
|
||||||
end
|
end
|
||||||
html
|
html
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ if @recurring_saved
|
||||||
page.hide 'recurring-todos-empty-nd'
|
page.hide 'recurring-todos-empty-nd'
|
||||||
page.insert_html :bottom,
|
page.insert_html :bottom,
|
||||||
'recurring_todos_container',
|
'recurring_todos_container',
|
||||||
:partial => 'recurring_todos/recurring_todo'
|
:partial => 'recurring_todos/recurring_todo', :locals => { :recurring_todo => @recurring_todo}
|
||||||
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
||||||
# update badge count
|
# update badge count
|
||||||
page['badge_count'].replace_html @count
|
page['badge_count'].replace_html @count
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ if @saved
|
||||||
|
|
||||||
if @recurring_todo.completed?
|
if @recurring_todo.completed?
|
||||||
# show completed recurring todo
|
# show completed recurring todo
|
||||||
page.insert_html :top, "completed_recurring_todos_container", :partial => 'recurring_todos/recurring_todo'
|
page.insert_html :top, "completed_recurring_todos_container", :partial => 'recurring_todos/recurring_todo', :locals => { :recurring_todo => @recurring_todo }
|
||||||
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
||||||
|
|
||||||
# set empty messages
|
# set empty messages
|
||||||
|
|
@ -14,7 +14,7 @@ if @saved
|
||||||
# recurring_todo is activated
|
# recurring_todo is activated
|
||||||
|
|
||||||
# show completed recurring todo
|
# show completed recurring todo
|
||||||
page.insert_html :top, "recurring_todos_container", :partial => 'recurring_todos/recurring_todo'
|
page.insert_html :top, "recurring_todos_container", :partial => 'recurring_todos/recurring_todo', :locals => { :recurring_todo => @recurring_todo }
|
||||||
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
||||||
|
|
||||||
# inform user if a new todo has been created because of the activation
|
# inform user if a new todo has been created because of the activation
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ if @saved
|
||||||
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
|
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
|
||||||
|
|
||||||
# replace old recurring todo with updated todo
|
# replace old recurring todo with updated todo
|
||||||
page.replace dom_id(@recurring_todo), :partial => 'recurring_todos/recurring_todo'
|
page.replace dom_id(@recurring_todo), :partial => 'recurring_todos/recurring_todo', :locals => { :recurring_todo => @recurring_todo }
|
||||||
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@recurring_todo), :duration => 3
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ end
|
||||||
-%><%=@actions_per_context[@actions_per_context.size()-1]['total'].to_i*100/@sum%>&
|
-%><%=@actions_per_context[@actions_per_context.size()-1]['total'].to_i*100/@sum%>&
|
||||||
&pie_labels=<%
|
&pie_labels=<%
|
||||||
0.upto @actions_per_context.size()-2 do | i |
|
0.upto @actions_per_context.size()-2 do | i |
|
||||||
%><%=truncate(@actions_per_context[i]['name'],@truncate_chars, '...')%>,<%
|
%><%=truncate(@actions_per_context[i]['name'], :length => @truncate_chars, :omission => '...')%>,<%
|
||||||
end
|
end
|
||||||
-%><%=truncate(@actions_per_context[@actions_per_context.size()-1]['name'],@truncate_chars,'...') %>&
|
-%><%=truncate(@actions_per_context[@actions_per_context.size()-1]['name'], :legnth => @truncate_chars, :omission => '...') %>&
|
||||||
&links=<%
|
&links=<%
|
||||||
0.upto @actions_per_context.size()-2 do | i |
|
0.upto @actions_per_context.size()-2 do | i |
|
||||||
%><%=url_for :controller => "contexts", :action => "show", :id=>@actions_per_context[i]['id']%>,<%
|
%><%=url_for :controller => "contexts", :action => "show", :id=>@actions_per_context[i]['id']%>,<%
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,9 @@ end
|
||||||
-%><%=@actions_per_context[@actions_per_context.size()-1]['total'].to_i*100/@sum%>&
|
-%><%=@actions_per_context[@actions_per_context.size()-1]['total'].to_i*100/@sum%>&
|
||||||
&pie_labels=<%
|
&pie_labels=<%
|
||||||
0.upto @actions_per_context.size()-2 do | i |
|
0.upto @actions_per_context.size()-2 do | i |
|
||||||
%><%=truncate(@actions_per_context[i]['name'], @truncate_chars, '...') %>,<%
|
%><%=truncate(@actions_per_context[i]['name'], :length => @truncate_chars, :omission => '...') %>,<%
|
||||||
end
|
end
|
||||||
-%><%=truncate(@actions_per_context[@actions_per_context.size()-1]['name'], @truncate_chars, '...') %>&
|
-%><%=truncate(@actions_per_context[@actions_per_context.size()-1]['name'], :length => @truncate_chars, :omission => '...') %>&
|
||||||
&links=<%
|
&links=<%
|
||||||
0.upto @actions_per_context.size()-2 do | i |
|
0.upto @actions_per_context.size()-2 do | i |
|
||||||
%><%=url_for :controller => "contexts", :action => "show", :id=>@actions_per_context[i]['id']%>,<%
|
%><%=url_for :controller => "contexts", :action => "show", :id=>@actions_per_context[i]['id']%>,<%
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ if @saved
|
||||||
|
|
||||||
# completed todos move from their context to the completed container
|
# completed todos move from their context to the completed container
|
||||||
unless @prefs.hide_completed_actions?
|
unless @prefs.hide_completed_actions?
|
||||||
page.insert_html :top, "completed_containeritems", :partial => 'todos/todo', :locals => { :parent_container_type => "completed" }
|
page.insert_html :top, "completed_containeritems", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => "completed" }
|
||||||
page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"}
|
page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"}
|
||||||
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
|
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
|
||||||
page.show 'tickler-empty-nd' if source_view_is(:project) && @deferred_count == 0
|
page.show 'tickler-empty-nd' if source_view_is(:project) && @deferred_count == 0
|
||||||
|
|
@ -33,7 +33,7 @@ if @saved
|
||||||
else
|
else
|
||||||
# todo is activated from completed container
|
# todo is activated from completed container
|
||||||
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@todo)
|
page.call "todoItems.ensureVisibleWithEffectAppear", item_container_id(@todo)
|
||||||
page.insert_html :bottom, item_container_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.insert_html :bottom, item_container_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"}
|
page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"}
|
||||||
page.show "empty-d" if @completed_count == 0
|
page.show "empty-d" if @completed_count == 0
|
||||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, incomplete items can't be empty
|
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, incomplete items can't be empty
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ if @saved
|
||||||
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
|
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
|
||||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||||
# show all todos in context
|
# show all todos in context
|
||||||
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
end
|
end
|
||||||
|
|
||||||
# update badge count
|
# update badge count
|
||||||
|
|
@ -52,7 +52,7 @@ if @saved
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
end
|
end
|
||||||
elsif source_view_is :project
|
elsif source_view_is :project
|
||||||
|
|
@ -63,17 +63,17 @@ if @saved
|
||||||
elsif @todo.deferred?
|
elsif @todo.deferred?
|
||||||
page[@todo].remove
|
page[@todo].remove
|
||||||
page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0)
|
page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0)
|
||||||
page.insert_html :bottom, "tickler", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.insert_html :bottom, "tickler", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page['tickler-empty-nd'].hide
|
page['tickler-empty-nd'].hide
|
||||||
page.replace_html "badge_count", @down_count
|
page.replace_html "badge_count", @down_count
|
||||||
elsif @todo_was_activated_from_deferred_state
|
elsif @todo_was_activated_from_deferred_state
|
||||||
page[@todo].remove
|
page[@todo].remove
|
||||||
page['tickler-empty-nd'].show if (@deferred_count == 0)
|
page['tickler-empty-nd'].show if (@deferred_count == 0)
|
||||||
page.insert_html :bottom, "p#{@todo.project_id}", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.insert_html :bottom, "p#{@todo.project_id}", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page["p#{@todo.project_id}empty-nd"].hide
|
page["p#{@todo.project_id}empty-nd"].hide
|
||||||
page.replace_html "badge_count", @down_count
|
page.replace_html "badge_count", @down_count
|
||||||
else
|
else
|
||||||
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
end
|
end
|
||||||
elsif source_view_is :deferred
|
elsif source_view_is :deferred
|
||||||
|
|
@ -87,7 +87,7 @@ if @saved
|
||||||
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
|
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@todo.context_id}"
|
||||||
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
|
page.call "todoItems.expandNextActionListingByContext", "c#{@todo.context_id}items", true
|
||||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||||
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.insert_html :bottom, "c#{@todo.context_id}items", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.replace_html("badge_count", @down_count)
|
page.replace_html("badge_count", @down_count)
|
||||||
page.delay(0.5) do
|
page.delay(0.5) do
|
||||||
page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items"
|
page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items"
|
||||||
|
|
@ -95,18 +95,18 @@ if @saved
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
end
|
end
|
||||||
elsif source_view_is :stats
|
elsif source_view_is :stats
|
||||||
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
elsif source_view_is :calendar
|
elsif source_view_is :calendar
|
||||||
if @due_date_changed
|
if @due_date_changed
|
||||||
page[@todo].remove
|
page[@todo].remove
|
||||||
page.show "empty_"+@original_item_due_id if @old_due_empty
|
page.show "empty_"+@original_item_due_id if @old_due_empty
|
||||||
page.hide "empty_"+@new_due_id
|
page.hide "empty_"+@new_due_id
|
||||||
page.insert_html :bottom, @new_due_id, :partial => 'todos/todo'
|
page.insert_html :bottom, @new_due_id, :partial => 'todos/todo', :locals => {:todo => @todo}
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
else
|
else
|
||||||
if @todo.due.nil?
|
if @todo.due.nil?
|
||||||
|
|
@ -114,7 +114,7 @@ if @saved
|
||||||
page[@todo].remove
|
page[@todo].remove
|
||||||
page.show "empty_"+@original_item_due_id if @old_due_empty
|
page.show "empty_"+@original_item_due_id if @old_due_empty
|
||||||
else
|
else
|
||||||
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :parent_container_type => parent_container_type }
|
page.replace dom_id(@todo), :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => parent_container_type }
|
||||||
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
page.visual_effect :highlight, dom_id(@todo), :duration => 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -223,8 +223,8 @@ class ProjectsControllerTest < TodoContainerControllerTestBase
|
||||||
login_as :admin_user
|
login_as :admin_user
|
||||||
u = users(:admin_user)
|
u = users(:admin_user)
|
||||||
post :actionize, :state => "active", :format => 'js'
|
post :actionize, :state => "active", :format => 'js'
|
||||||
assert_equal 1, projects(:gardenclean).position
|
assert_equal 2, projects(:gardenclean).position
|
||||||
assert_equal 2, projects(:moremoney).position
|
assert_equal 1, projects(:moremoney).position
|
||||||
assert_equal 3, projects(:timemachine).position
|
assert_equal 3, projects(:timemachine).position
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue