Monday, January 22, 2007

Comatose, TaskTHIS, and Theme Support. Oh My!

Well, I’ve been a little remiss in my open-source development of late. Many apologies, things have been a bit hectic. You know the feeling, I’m sure.

But that’s not why I’m posting. I thought I’d outline my ideas for the future of these projects and get your feedback and/or ideas.

Comatose, The Micro CMS Plugin

The things that are definitely coming…

Edge Rails - Since Rails 1.2 is now official, it’s time to finally support ‘edge rails’. :-D

Actually, I have a version that runs on Rails 1.2 now, but I’m debating about Rails 1.1 backward compatibility. The new version changes quite a bit. The DEFER_COMATOSE_LOAD stuff goes away, replaced by better configuration support and a Dispatch::to_prepare block. Plus you no longer override the ComatoseAdminController for authentication, instead in the configuration you specify modules to include in the class. Oh yeah, and the controllers no longer extend ApplicationController.

Test Harness - The tests in the plugin itself are very spartan, at best. I have a horribly ugly test harness I use for the actual unit testing that I’m going to clean up and release.

Some possibilities

Liquid Only - I really think I’m going to drop ERb support. How many of you use ERb over Liquid for page processing?

RESTful Pages - Perhaps using the new RESTfully CRUDDY support would be useful. The idea of having an API for pages is interesting.

Mount Behaviors - I haven’t thought this through yet, it just popped into my head: map.comatose_root 'devblog', :index=>'blog', :behavior=>'blog'

This example would add ‘blog-like’ support such as all children being paged entries (showing last 10, next page, last page, etc.), automatic hAtom microformat support, and maybe some sort of archives… I don’t know. I still haven’t thought about this too much.

The behavior support would be pluggable, much like text-filters and drops… Can you think of any other behavior that would make sense?

Maybe :behavior=>'syndicated' to create RSS/ATOM feeds of the child pages? Perhaps they’d be mixable by saying :behavior=>'blog syndicated' or :behavior=>'blog,syndicated'.

The probably nots

Media Management - It just feels like too much. I have a hacked up version of Comatose that supports page attachments. But you wind up having to deal with upload directories, and file permissions and… It just feels too heavy. And too heavy != micro.

Perhaps it could be a separate plugin?

TaskTHIS

TaskTHIS is getting a bit long in the tooth. It was written right about the time some of my AJAX patches were being added to Rails. Which was pre 1.0. So, yeah. It needs some love.

It was created as a show-and-tell for the then-new-and-nifty AJAX support. Which, of course, is now old hat.

In keeping with the tradition of show-and-tell, I thought TaskTHIS would be an excellent application to show how to use the new CRUD/REST/Resources stuff in Rails 1.2.

I have a few ideas outlined here. The biggest ones are:

API - This is fairly straight-forward, we’ll get most if it from Rails. We’ll just add the appropriate authentication for the XML requests.

OpenID - I was thinking replacing the existing login system with OpenID authentication. I like the idea of just typing in my domain to login… Who needs passwords? Seriously though, this may be a bit controversial — please weigh in.

Oh, I forgot to mention, TaskTHIS.com is working again.

Theme Support Plugin

Basically, just add any outstanding patches and ensure it works on Rails 1.2. I imagine the routing stuff will need to be tweaked.

Whadda Ya Think?

What would/wouldn’t you like to see in any of these projects?

32 comments:

  1. I have recently started to use Comatose and it is great. It was very easy to add new modules to it. In my project I added custom news controller and can access them with Liquid hook in page content. I had to add also a field to page that would make possible to mark some pages (like header and footer) visible only to "master_admin".
    As to media, I also have simple file_manager controller where I manage pictures and links to other pages in TinyMCE.
    It would be great if you make a release that works with Rails 1.2... the routing problem cut off my wings.

    ReplyDelete
  2. Matt, please, oh please keep Erb support. Liquid is great for what it was intended to do (non evaling templating), but can be so constraining for some other tasks (because you can't eval anything without going through major hoops)!

    ReplyDelete
  3. New to Comatose, but I'm a HAML guy -- it's just easier to read the templates and the resulting HTML. So I'm going to attempt to use ERB, but with HAML templates and see if the "right thing" happens.

    ReplyDelete
  4. [DWFrank:3] Never mind. I'm crazy. But I would like HAML support.

    ReplyDelete
  5. Matt, I hope you could find time to work on Theme Support. I can't get pass through the routing problem even after following Bob's suggestion - http://www.freeonrails.com/node/16711.

    ReplyDelete
  6. Re: Comatose
    I would advocate a point release with support for Rails 1.2, but without any additional features or changes. (And I personally don't feel it's important to maintain backwards compatibility with 1.1.)
    Then if you want to do another release where you change the features and functionality, make it the one after that.
    I also hope you maintain erb support, as I use it.

    ReplyDelete
  7. One thing I forgot to add, backward compatibility is not terribly important for me. You could keep the current release available for folks that want to stick to 1.1.6

    ReplyDelete
  8. hey, matt..
    just wanted to put my vote in really quick.. i am using the themes plugin for alot of projects, and mine just broke.. i would like to see this reworked for rails 1.2..
    i started working on it last night, but i am short on time t his week..
    anyway.. good work on all your stuff!
    you rock!

    ReplyDelete
  9. [finn:6] Yes, I will definitely be releasing an updated version with Rails 1.2 support. It's coming the next couple of days, probably.
    Just fishing around for feedback about the other ideas.
    Oddly, nobody has said they need Rails 1.1 support. Which is good, that'll make this next release quick and easy!

    ReplyDelete
  10. Matt, nice work! We've been integrating Comatose into our systems and find it to be fantastic as it does just the bare bones and allows us to custom-build the rest of our functionality as needed and we're not having to fit into someone else's CMS box.\n\nOne thing I would love to see is some sort of extending model. For example, we really need the ability to be able to have fields in Comatose for page title, link title AND slug. This is because the link the user clicks on is often a short title whereas the page title that is displayed in the page (and in the nav bar) is often longer. The slug, of course, is short and concise and can't contain special characters.\n\nDo do this, we added a column to the pages table and added a field to the admin layout.\n\nWhat would be better would be to allow developers to create a "comatose_options" table that is linked to a page by a page_id column. We could then put as many new columns in this options table as we need and Comatose could automatically render the fields in the admin view.\n\nDoes this make sense? It would mean we don't have to hack Comatose so it wouldn't break next time we update.\n\nAnyway, keep up the great work!\n\nHere's a site based on Comatose for your reference: "Ruby Bay Lodge & Vineyard":http://www.rubybayvineyard.co.nz

    ReplyDelete
  11. The Themes plugin has been awesome. Thank you for this contribution.
    I've had the Themes plugin working in 1.2/edge with these hacks:
    First, I commented out everything in routeset_ex.rb. And added those routes manually to "my routes.rb":http://pastie.caboo.se/39806
    I've also just got ActionMailer themes working by changing the initialize method in actionmailer_ex.rb. Here's a diff. Basically I just made sure the theme parameter was indeed lobbed off the array, the original way just empties out the hash parameter at the end and sticks a :current_theme in there, so the create! method was complaining about too many parameters. It seems to work, but I'm still a little confused what the consequences of not having that :current_theme param sent into "create!" is about to have.
    "http://pastie.caboo.se/39808":http://pastie.caboo.se/39808

    ReplyDelete
  12. [Nate:11] Thanks for tip how to solve problem with routes.\n\nAnyone know how to solve this:\nhttp://groups.google.com/group/liquid-templates/browse_thread/thread/eef63c5d8bb227a5/ea6aa596532922a6#ea6aa596532922a6\n?

    ReplyDelete
  13. Oh please don't nuke erb support. And any chance that you can get the themes_support fixed for 1.2? Also ActionMailer is still busted for me when I try to send multi-part messages:
    No rhtml, rxml, or delegate template found for user_notifier/signup_notification.text.html.rhtml

    ReplyDelete
  14. Matt, Did you fix Theme generator for Rails 1.2, Is there any way I can pull the version that would work with Rails 1.2 ?

    ReplyDelete
  15. I have posted the fix for the Theme support plugin and Rails 1.2.X in Rub y Forum. Here is the link
    http://www.ruby-forum.com/topic/100163#215694

    ReplyDelete
  16. this patch works for me on rails 1.2.2\n\nhttp://pastie.caboo.se/45397

    ReplyDelete
  17. anyone have a patch to get multi-part activemailer stuff working with themes?

    ReplyDelete
  18. [Tim:17]
    actionmailer that is of course

    ReplyDelete
  19. Please don't nuke ERB support from Comatose. Am I the only one who hates the look of Liquid templates?
    I'd like to be able to pick which processor to use on a per-page basis rather than always using the 'default'.

    ReplyDelete
  20. Hi!
    I have really enjoyed using the theme_support plugin.
    I'm using Rails 1.2.2 now and I have applied the patch supplied by seth (thanks for the url).
    The only problem I have left, is to get rails to actually find the layout to be used. The layout I want to use is called 'site'. And I have it present in the in the layouts folder of my layout, I have created the cache so it's in the public dir. I also checked the current_layout which returns the layout var.
    But still I get a missing template error. Any idea why?

    ReplyDelete
  21. I have a working copy on theme_support for Rails 1.2.x at http://imaspy.com/news/read/5

    ReplyDelete
  22. Thanks for the notes on getting this to work under rails 1.2.x. I downloaded the files provided by Dallas Slieker, above, and added the suggestion from Ian Duggan, and it seemed to do the trick for me. Thanks.

    ReplyDelete
  23. Paolo AngiolettiMay 7, 2007 at 9:48 PM

    Good job! A lot of thanks to Dallas Slieker for his "theme_support" Plugin For Rails 1.2.x ... and also thanks to Ian Duggan for his very good fixing on layout recognition

    ReplyDelete
  24. This isn't working on rails 1.2.3..
    How I can fix it?

    ReplyDelete
  25. Hi guys,
    Can anyone here share the patch from Dallas Slieker. His website is down for several days now.
    Thanks.

    ReplyDelete
  26. Greg,
    Site's up now. Apologies for the inconvenience.

    ReplyDelete
  27. Thanks Dallas.
    I'm getting this error:
    d:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routi
    ng.rb:954:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
    from d:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_con
    troller/routing.rb:954:in `build'
    from d:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_con
    troller/routing.rb:1172:in `add_route'
    from d:/dev/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_con
    troller/routing.rb:1178:in `add_named_route'
    Any ideas why?
    Thanks.

    ReplyDelete
  28. I am also having problems with multipart emails. Same problem as Tim. Anybody figured that out?

    ReplyDelete
  29. Hi,
    I also got the problem using Theme Support on Rails 1.2.3 and ActionMailer views. They just aren't found by pick_template_extension.
    search path should be "." (I think so)
    does someone know how to make this work? I currently REMOVED theme support just to make my notifiers work again.
    thanks in advance

    ReplyDelete
  30. Hey Matt,
    I posted in my blog on getting the Theme Support Plugin working in version 1.2.3.
    Hope it helps someone!
    Here it is:
    http://manicprogrammer.com/cs/blogs/heynemann/archive/2007/09/21/theme-support-in-rails-and-a-wild-community.aspx

    ReplyDelete
  31. I love theme_support and use it in several projects.
    Nevertheless I have had to fix a couple of things for it to work with rails 1.2.5 ( http://www.gaugeus.com/ramblings/2007/11/4/adding-theme-support-to-a-ruby-on-rails-application ) and for it to support routes with extensions such as rxml ( http://www.gaugeus.com/ramblings/2007/12/3/rendering-templates-extensions-theme_support-errors-template-missing-no-rhtml-rxml-delegate-template-found ).

    ReplyDelete