mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 01:08:50 +01:00
fix moving todos from one context to another on tag view
also fix ordening on the collections on the tag view page
This commit is contained in:
parent
4ac09ed3ae
commit
4d11e156f4
3 changed files with 25 additions and 16 deletions
|
|
@ -106,6 +106,7 @@ class TodosController < ApplicationController
|
|||
@projects = current_user.projects.find(:all)
|
||||
@contexts = current_user.contexts.find(:all)
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
@tag_name = params['_tag_name']
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
@ -212,7 +213,7 @@ class TodosController < ApplicationController
|
|||
@todo.complete!
|
||||
end
|
||||
# strange. if checkbox is not checked, there is no 'done' in params.
|
||||
# Therfore I've used the negation
|
||||
# Therefore I've used the negation
|
||||
if !(params['done'] == '1') && @todo.completed?
|
||||
@todo.activate!
|
||||
end
|
||||
|
|
@ -336,6 +337,7 @@ class TodosController < ApplicationController
|
|||
|
||||
# /todos/tag/[tag_name] shows all the actions tagged with tag_name
|
||||
def tag
|
||||
@page_title = "TRACKS::Tagged with \'#{@tag_name}\'"
|
||||
@source_view = params['_source_view'] || 'tag'
|
||||
@tag_name = params[:name]
|
||||
|
||||
|
|
@ -344,28 +346,33 @@ class TodosController < ApplicationController
|
|||
|
||||
@tag = Tag.find_by_name(@tag_name)
|
||||
@tag = Tag.new(:name => @tag_name) if @tag.nil?
|
||||
|
||||
tag_collection = @tag.todos
|
||||
@not_done_todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'active'])
|
||||
|
||||
@not_done_todos = tag_collection.find(:all,
|
||||
:conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'active'],
|
||||
:order => 'todos.completed_at DESC, todos.created_at DESC')
|
||||
@hidden_todos = current_user.todos.find(:all,
|
||||
:include => [:taggings, :tags, :context],
|
||||
:conditions => ['tags.name = ? AND (todos.state = ? OR (contexts.hide = ? AND todos.state = ?))', @tag_name, 'project_hidden', true, 'active'])
|
||||
:conditions => ['tags.name = ? AND (todos.state = ? OR (contexts.hide = ? AND todos.state = ?))', @tag_name, 'project_hidden', true, 'active'],
|
||||
:order => 'todos.completed_at DESC, todos.created_at DESC')
|
||||
@deferred = tag_collection.find(:all,
|
||||
:conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'deferred'],
|
||||
:order => 'show_from ASC, todos.created_at DESC')
|
||||
# If you've set no_completed to zero, the completed items box isn't shown on
|
||||
# the tag page
|
||||
max_completed = current_user.prefs.show_number_completed
|
||||
@done = tag_collection.find(:all,
|
||||
:limit => max_completed,
|
||||
:conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'completed'],
|
||||
:order => 'todos.completed_at DESC')
|
||||
|
||||
@contexts = current_user.contexts.find(:all)
|
||||
@contexts_to_show = @contexts.reject {|x| x.hide? }
|
||||
|
||||
@deferred = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'deferred'])
|
||||
|
||||
@page_title = "TRACKS::Tagged with \'#{@tag_name}\'"
|
||||
# If you've set no_completed to zero, the completed items box isn't shown on
|
||||
# the home page
|
||||
max_completed = current_user.prefs.show_number_completed
|
||||
@done = tag_collection.find(:all, :limit => max_completed, :conditions => ['taggings.user_id = ? and state = ?', current_user.id, 'completed'])
|
||||
# Set count badge to number of items with this tag
|
||||
@not_done_todos.empty? ? @count = 0 : @count = @not_done_todos.size
|
||||
@down_count = @count
|
||||
# @default_project_context_name_map =
|
||||
# build_default_project_context_name_map(@projects).to_json
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue