Typo Administration: article tagging II...

Posted by Steve Longdo Wed, 08 Mar 2006 23:31:00 GMT

Let's go through the the steps I have taken so far to add auto completion of the tagging capabilities of Typo.
  1. Checked out a fresh copy of the trunk from svn://typosphere.org/typo/trunk
  2. Ran it against my backup database of this site.
  3. Fired up TextMate and started to work!
I made a decision right off to not use AJAX for this. Building the entire list of tags in use for an individual user's blog shouldn't be too much overhead to send down the wire once, versus pinging the server each time a key is typed. (Although Typo foils my effort to reduce roundtrips to the server, because live preview of Articles monitors the whole Article form not just the Title and Body fields...) I am sticking by my decision for now, if we want to add del.icio.us, technorati or even ma.gnolia.com tags in the future then AJAX will come back into the picture. For now we will Keep It Simple S...teve :-)
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:
app/controllers/admin/content_controller.rb
def 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
The @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.

Typo Administration: article tagging...

Posted by Steve Longdo Tue, 07 Mar 2006 18:25:00 GMT

I’ve been working on adding support to Typo for tagging suggestions. Similiar to how del.icio.us makes recomendations when you are tagging a resource. Saw it on the Typo wishlist and it seemed like a fun quick hit.

I have it working with pulling the tags from the existing tags in your Typo database. I am still working out some JavaScript issues. The invaluable FireBug is helping me track them down and I am working on extracting the CSS markup into the admin.css file. I hope to contribute this to Typo in time for the official 4.0 release. I’ll update the article when I have submitted a patch. It will probably take me longer to write test cases than implement the feature! That is right, no use of TDD on this one…


I also made the “Categories” section toggle like the “Extended Content” and “Advanced Options” sections. Once this is out who will still use categories? :-)

Spreading faster than the bird flu...

Posted by Steve Longdo Thu, 02 Mar 2006 03:07:00 GMT

Congratulations to Anchorage, Alaska for coming into the fold. Leaving just a few more states to go. As excited as I am to pick up another United State, something even cooler has happened: Norway. Thanks to the city of Bodø for stopping by.

Also a very special thanks to Shlomo(Toda Raba!, תודה רבה) for visiting from Israel!

So I think I am going to have reprioritize which countries to get to visit here next. I was thinking South America, but they are finding me on their own, Argentina, Brazil, and Chilé. Literally the ABC’s of South America have already stopped by. I would like to get a visit from Venezuela though. I traveled there many years ago. If anyone from there stops by I will try to find some of my old photos from Caracas and post them.

Geting visits from more countries that the US doesn’t get along with well would be neat. I noticed that I have had two visitors from Vietnam one even from Ho Chi Minh City. Strange to think about my father fighting there in the war and now people are beginning to exchange ideas and information again.

Next on the list Cuba, I am not sure what kind of internet access is allowed there, but I hope someone finds the way here. Visitantes agradables de Cuba.

I would be equally excited to pick up some traffic from the Korean Peninsula. Both North and South are welcome: 여보세요 한반도에서 방문자에.

Last but certainly not least Lichtenstein I am not sure if the anyone besides the Prince on the Hill has internet access there, but if so “Willkommen im voraus zu den Besuchern von Lichtenstein.” I think I have pictures from when I was there to post as well…

Yes I know the US gets along with South Korea and Lichtenstein… for now :-)
Steve Longdo World Domination Map
Click for larger size


UPDATE: I added lightbox capability to the Google Analytics Map so that you can see it at a larger size. Plus it is just that much more AJAX goodness.

I have also switched the site over to a modified version of Jamie Hill’s excellent Lucid theme from the Typo Garden contest. Leave a comment if you encounter any unusual errors while browsing the site, they are probably my fault from tinkering…

Read more...

Older posts: 1 2 3 4