Typo Administration: article tagging II...
- Checked out a fresh copy of the trunk from svn://typosphere.org/typo/trunk
- Ran it against my backup database of this site.
- Fired up TextMate and started to work!
First off we will need to get the Tags down to the view code. So off to the admin controller code's new and edit methods to get our Tags included:
Theapp/controllers/admin/content_controller.rbdef new ... @categories = Category.find(:all, :order => 'UPPER(name)') @tags = Tag.find_all_with_article_counters(666) ... end def edit ... @selected = @article.categories.collect { |cat| cat.id.to_i } @tags = Tag.find_all_with_article_counters(666) if request.post? ... end
@tags = Tag.find_all_with_article_counters(666) is how we are accomplishing this. I could just get all the Tags with Tag.find(:all) but this little bit of premature optimization will come in handy if we want to show a count of how many articles are already tagged with a given tag. We can also limit our search to less than 666 records. I just like to tag things a lot.
I will post the next part later today as this post is getting a bit longish.

