mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 17:28:50 +01:00
fixes #929 where editing a newly added todo on the tag view would cause an error
because tag_name was not passed around
This commit is contained in:
parent
bf6b873d7c
commit
37a45313a0
3 changed files with 15 additions and 8 deletions
|
|
@ -50,6 +50,7 @@ class TodosController < ApplicationController
|
|||
|
||||
def create
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
@tag_name = params['_tag_name']
|
||||
p = TodoCreateParamsHelper.new(params, prefs)
|
||||
p.parse_dates() unless mobile?
|
||||
tag_list = p.tag_list
|
||||
|
|
@ -506,9 +507,9 @@ class TodosController < ApplicationController
|
|||
|
||||
def auto_complete_for_tag
|
||||
@items = Tag.find(:all,
|
||||
:conditions => [ "name LIKE ?", '%' + params['tag_list'] + '%' ],
|
||||
:order => "name ASC",
|
||||
:limit => 10)
|
||||
:conditions => [ "name LIKE ?", '%' + params['tag_list'] + '%' ],
|
||||
:order => "name ASC",
|
||||
:limit => 10)
|
||||
render :inline => "<%= auto_complete_result(@items, :name) %>"
|
||||
end
|
||||
|
||||
|
|
@ -718,10 +719,15 @@ class TodosController < ApplicationController
|
|||
end
|
||||
|
||||
def determine_deferred_tag_count(tag)
|
||||
tag_collection = Tag.find_by_name(tag).todos
|
||||
@deferred_tag_count = tag_collection.count(:all,
|
||||
:conditions => ['todos.user_id = ? and state = ?', current_user.id, 'deferred'],
|
||||
:order => 'show_from ASC, todos.created_at DESC')
|
||||
tags = Tag.find_by_name(tag)
|
||||
if tags.nil?
|
||||
# should normally not happen, but is a workaround for #929
|
||||
@deferred_tag_count = 0
|
||||
else
|
||||
@deferred_tag_count = tags.todos.count(:all,
|
||||
:conditions => ['todos.user_id = ? and state = ?', current_user.id, 'deferred'],
|
||||
:order => 'show_from ASC, todos.created_at DESC')
|
||||
end
|
||||
end
|
||||
|
||||
def render_todos_html
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ module TodosHelper
|
|||
|
||||
def should_show_new_item
|
||||
|
||||
if @todo.project.nil? == false
|
||||
unless @todo.project.nil?
|
||||
# do not show new actions that were added to hidden or completed projects
|
||||
# on home page and context page
|
||||
return false if source_view_is(:todo) && (@todo.project.hidden? || @todo.project.completed?)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
</div>
|
||||
|
||||
<%= source_view_tag( @source_view ) %>
|
||||
<%= hidden_field_tag :_tag_name, @tag_name.underscore.gsub(/\s+/,'_') if source_view_is :tag %>
|
||||
|
||||
<div class="submit_box">
|
||||
<div class="widgets">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue