[typo] Simple Workflow + Latest Posts

Scott Laird scott at sigkill.org
Wed Aug 10 16:27:09 EDT 2005

On Aug 10, 2005, at 1:08 PM, Kyle Cooney wrote:
> I'm working out some kinks on my site, still very rough  
> technically, but I'm wondering if anyone has built modules/custom  
> additions to typo that they'd be willing to share.  Specically, I'm  
> looking for the following:
> - Ability to save messages in draft form and come back to publish  
> them later.  Better if anyone has built a module to allow for  
> autopublishing on a specific date.

In general, you should be able to mark articles as unpublished and  
have them behave as you'd expect.  You'll have to manually publish  
them though.  Post-dating articles and having them automatically  
appear once their time comes up is on the list for the next release;  
it's not very difficult, but there's at least a half-dozen places in  
Typo where we'll have to make sure that we're doing the right thing.

> - Second, and perhaps more importantly, I'm using a layout on my  
> site that only shows one post at a time.  In addition to linking to  
> an archives section, I'm looking for a sidebar module that will  
> show the last X(5-10) number of posts on the site.

That should be pretty easy.  Just create a new sidebar and have it  
display the titles (and links) for some number of articles.  Start by  
making a copy of the category controller (in components/plugins/ 
sidebars/category*) and calling it 'articles'.  Edit the new  
article_controller.rb and swap all references to 'category to  
'article'.  Don't forget to change the class name on the first line.   
You should probably remove the self.default_config and configure  
methods.  Then change the content method to be something like this:

   def content
     @articles = Articles.find(:all, :limit => 10, :conditions =>  
["published == 1"]

Then edit articles/content.rhtml.  You can mostly just swap  
'articles' for 'categories' wherever they appear.  Swap the link_to  
bit on the middle of the loop for article_link(article.title,  
article).  You should be able to safely remove all of the conditional  

That should be about it.  If you're running Typo in production mode,  
then you'll need to restart it before it notices the new sidebar.  If  
you're in development mode, then it should show up right away.


More information about the Typo-list mailing list