Removed acts_as_taggable because it is deprecated and replaced with has_many_polymorphs:

<http://blog.evanweaver.com/articles/2006/06/02/has_many_polymorphs>

Also removed chronic because it is not currently used.

  * Tags are entered separated by commas, so tags with spaces are allowed
  * When you edit an action, whatever is submitted in the tags text field replaces existing tags: if you submit an empty field, tags are removed from the action
  * Clicking on a tag shows a page listing all the actions with that tag (/todo/tag/tag+name)

Todo:
  
  * Tests
  * RESTful routes for Tags (if it makes sense for tags - I haven't decided)
  * If you remove tags for an action, it removes the entries from the Taggings table, but it can leave an orphan Tag if there are no more Taggings for that Tag. One problem is that another user might have an identically-named Tag, so we don't want to remove their Tag, just because we have finished with it. I'm not sure how to arrange this yet.
  
Don't forget to rake db:migrate. There is also a change in config/environment.rb.tmpl, so remember to copy the changes to your copy.
 


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@425 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2007-02-04 15:33:24 +00:00
parent 6fce959bf8
commit d0666038f2
89 changed files with 1612 additions and 3317 deletions

View file

@ -7,6 +7,7 @@ require "redcloth"
require 'date'
require 'time'
Tag # We need this in development mode, or you get 'method missing' errors
class ApplicationController < ActionController::Base

View file

@ -33,7 +33,6 @@ class TodosController < ApplicationController
def create
@item = @user.todos.build
p = params['request'] || params
# @item.tag_with(params[:tag_list])
@item.attributes = p['todo']
if p['todo']['project_id'].blank? && !p['project_name'].blank? && p['project_name'] != 'None'
@ -70,9 +69,11 @@ class TodosController < ApplicationController
@item.show_from = parse_date_per_user_prefs(p['todo']['show_from'])
end
@item.tag_with(params[:tag_list], @user)
@item.save
@item.tag_with(params[:tag_list],@user)
@saved = @item.save
respond_to do |wants|
wants.html { redirect_to :action => "index" }
wants.js do
@ -126,7 +127,7 @@ class TodosController < ApplicationController
def update
@item = check_user_return_item
@item.tag_with(params[:tag_list], @user)
@item.tag_with(params[:tag_list],@user)
@original_item_context_id = @item.context_id
@original_item_project_id = @item.project_id
@original_item_was_deferred = @item.deferred?
@ -245,10 +246,11 @@ class TodosController < ApplicationController
#
def tag
@tag = tag_name = params[:name]
if Tag.find_by_name(tag_name)
@todos = Todo.find_tagged_with(tag_name, @user)
else
tag_collection = Tag.find_by_name(tag_name).todos
if tag_collection.empty?
@todos = []
else
@todos = tag_collection.find(:all, :conditions => ['taggings.user_id = ?', @user.id])
end
@count = @todos.size unless @todos.empty?