diff --git a/tracks/app/controllers/todos_controller.rb b/tracks/app/controllers/todos_controller.rb index c4c8da00..54db5389 100644 --- a/tracks/app/controllers/todos_controller.rb +++ b/tracks/app/controllers/todos_controller.rb @@ -303,12 +303,14 @@ class TodosController < ApplicationController @contexts = @user.contexts.find(:all, :include => [ :todos ]) @contexts_to_show = @contexts.reject {|x| x.hide? } + + @deferred = tag_collection.find(:all, :conditions => ['taggings.user_id = ? and state = ?', @user.id, 'deferred']) @page_title = "TRACKS::Tagged with \'#{@tag}\'" # If you've set no_completed to zero, the completed items box # isn't shown on the home page max_completed = @user.prefs.show_number_completed - @done = @user.completed_todos.find(:all, :limit => max_completed, :include => [ :context, :project, :tags ]) unless max_completed == 0 + @done = tag_collection.find(:all, :limit => max_completed, :conditions => ['taggings.user_id = ? and state = ?', @user.id, 'completed']) # Set count badge to number of items with this tag @not_done_todos.empty? ? @count = 0 : @count = @not_done_todos.size @default_project_context_name_map = build_default_project_context_name_map(@projects).to_json diff --git a/tracks/app/views/todos/tag.rhtml b/tracks/app/views/todos/tag.rhtml index 2361fa15..2453376b 100644 --- a/tracks/app/views/todos/tag.rhtml +++ b/tracks/app/views/todos/tag.rhtml @@ -8,9 +8,14 @@ <%= render :partial => "contexts/context", :collection => @contexts_to_show, :locals => { :collapsible => true } %> + + <% unless @deferred.nil? -%> + <%= render :partial => "todos/deferred", :locals => { :deferred => @deferred, :collapsible => true, :append_descriptor => "for this tag" } %> + <% end -%> + <% unless @done.nil? -%> <%= render :partial => "todos/completed", - :locals => { :done => @done, :collapsible => true, :append_descriptor => nil } %> + :locals => { :done => @done, :collapsible => true, :append_descriptor => "for this tag" } %> <% end -%> diff --git a/tracks/db/schema.rb b/tracks/db/schema.rb index 95666273..0afa6c2a 100644 --- a/tracks/db/schema.rb +++ b/tracks/db/schema.rb @@ -5,10 +5,10 @@ ActiveRecord::Schema.define(:version => 31) do create_table "contexts", :force => true do |t| - t.column "name", :string, :default => "", :null => false - t.column "hide", :integer, :limit => 4, :default => 0, :null => false - t.column "position", :integer, :default => 0, :null => false - t.column "user_id", :integer, :default => 0, :null => false + t.column "name", :string, :default => "", :null => false + t.column "position", :integer, :null => false + t.column "hide", :boolean, :default => false + t.column "user_id", :integer, :default => 1 t.column "created_at", :datetime t.column "updated_at", :datetime end @@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 31) do add_index "contexts", ["user_id", "name"], :name => "index_contexts_on_user_id_and_name" create_table "notes", :force => true do |t| - t.column "user_id", :integer, :default => 0, :null => false - t.column "project_id", :integer, :default => 0, :null => false + t.column "user_id", :integer, :null => false + t.column "project_id", :integer, :null => false t.column "body", :text t.column "created_at", :datetime t.column "updated_at", :datetime @@ -44,7 +44,7 @@ ActiveRecord::Schema.define(:version => 31) do end create_table "preferences", :force => true do |t| - t.column "user_id", :integer, :default => 0, :null => false + t.column "user_id", :integer, :null => false t.column "date_format", :string, :limit => 40, :default => "%d/%m/%Y", :null => false t.column "week_starts", :integer, :default => 0, :null => false t.column "show_number_completed", :integer, :default => 5, :null => false @@ -65,8 +65,8 @@ ActiveRecord::Schema.define(:version => 31) do create_table "projects", :force => true do |t| t.column "name", :string, :default => "", :null => false - t.column "position", :integer, :default => 0, :null => false - t.column "user_id", :integer, :default => 0, :null => false + t.column "position", :integer, :null => false + t.column "user_id", :integer, :default => 1 t.column "description", :text t.column "state", :string, :limit => 20, :default => "active", :null => false t.column "created_at", :datetime @@ -83,7 +83,7 @@ ActiveRecord::Schema.define(:version => 31) do t.column "updated_at", :datetime end - add_index "sessions", ["session_id"], :name => "sessions_session_id_index" + add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" create_table "taggings", :force => true do |t| t.column "taggable_id", :integer @@ -103,16 +103,16 @@ ActiveRecord::Schema.define(:version => 31) do add_index "tags", ["name"], :name => "index_tags_on_name" create_table "todos", :force => true do |t| - t.column "context_id", :integer, :default => 0, :null => false - t.column "description", :string, :limit => 100, :default => "", :null => false + t.column "context_id", :integer, :null => false + t.column "project_id", :integer + t.column "description", :string, :default => "", :null => false t.column "notes", :text t.column "created_at", :datetime t.column "due", :date t.column "completed_at", :datetime - t.column "project_id", :integer - t.column "user_id", :integer, :default => 0, :null => false + t.column "user_id", :integer, :default => 1 t.column "show_from", :date - t.column "state", :string, :limit => 20, :default => "immediate", :null => false + t.column "state", :string, :limit => 20, :default => "immediate", :null => false end add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state" @@ -122,10 +122,10 @@ ActiveRecord::Schema.define(:version => 31) do add_index "todos", ["user_id", "context_id"], :name => "index_todos_on_user_id_and_context_id" create_table "users", :force => true do |t| - t.column "login", :string, :limit => 80 - t.column "password", :string, :limit => 40 + t.column "login", :string, :limit => 80, :default => "", :null => false + t.column "password", :string, :limit => 40, :default => "", :null => false t.column "word", :string - t.column "is_admin", :integer, :limit => 4, :default => 0, :null => false + t.column "is_admin", :boolean, :default => false, :null => false t.column "first_name", :string t.column "last_name", :string t.column "auth_type", :string, :default => "database", :null => false