Can you guess what time it is? That’s right! It’s time for another Comatose update!
So, what’s new? Here are the main things:
- Page reordering
- Updated administration UI
- Parameterized inline rendering
- Fragment caching, and a pre-caching hook if you want more control of such things
- Better importing/exporting of pages
- Misc. bug-fixes
Installation
It's as simple as ever:
$ ./script/plugin source http://mattmccray.com/svn/rails/plugins $ ./script/plugin install comatose $ ./script/generate comatose_migration $ rake migrate
Or, for you (OK, us) early adopters:
$ rapt discover --no-prompt $ rapt install comatose $ ./script/generate comatose_migration $ rake migrate
Then, in your routes.rb:
map.comatose_root ''
Upgrading
For those of you upgrading from version 0.4, there aren’t any new db fields — so you won’t need to worry about migrations. However, there are changes to the CSS, JavaScript, and Views. So you might want to diff those with your customized versions (if you’re customizing the Admin).
Oh, and I’ve also bit the bullet and added a few images to spice it up. For new installations, it’ll automatically copy them into RAILS_ROOT/public/images/comatose/
.
For existing installations, you’ll want to run:
$ rake comatose:copy_images
That should pretty much do it. Don’t forget to glance over the 400+ line README file.
From the ChangeLog:
[version 0.5] * Added support for parameterized inline rendering of comatose pages. Use like a partial: render :comatose=>'path', :locals=>{:username=>'stuff'} the locals hash will be sent to the ERB context for use when rendering the page. * Support for a Hash ERB context exists all the way down to the TextFilters. * Initial support for fragment caching for inline rendering. It's turned off by default. Send :use_cache=>true in the render :comatose=>'' tag to use it. Caching will also not be used if you are sending the page parameters via the ActionController::Base.fragment_cache_store * Return reloadable? false for the ComatoseController by default... This should prevent the development mode hassles people have been having. * Updated data migration tasks to better support nested pages. - comatose:data:export FROM=page_path TO_FILE=file_path - comatose:data:import TO=page_path FROM_FILE=file_path - FROM_FILE and TO_FILE default to 'db/comatose-pages.yml' - FROM and TO default to '', the page tree root * Fixed 'Clear Page Cache' bug -- it didn't handle the page root being an array like it should have. * Removed :page_title and :page_keywords from session * Updated the rails_version in the about.yml to 1.1+ -- just because I haven't tested it on anything less than that. If you have, and it works, let me know! * Adds the utf8 header to all output (text/html; charset=utf-8). Use ComatoseController.force_utf8 = false to disable. * Initial support for page reordering (via AJAX) * Updated the administration look-n-feel.
Enjoy! As always, if you have any questions/problems feel free to give me a shout.
Hey Matt...thanks for another update. Looking good so far! I am getting an error running rake comatose:copy_images - but I manually copied the folder over, and it's just fine.
ReplyDeleteCheers!! Cameron
Hey, thanks for this. I'm using Comatose for a new site, and so far it's being great.
ReplyDeleteQuestion/Suggestion: What about allowing ActionView::Helpers methods within a page body? That would be useful for linking to other pages within the Rails app.
Matt,
ReplyDeleteAnother great job! Just upgraded and loving the changes...at this page you shoulbe at 1.0 by next week!
Very nice! Thanks.
ReplyDeleteJust a note on my usage...To make managing "private" sections of the CMS tree easier, I created a child page off of the root named "private" and then coded my authorize filter so that every child hanging from that page requires authentication. To do that (without doubling-up on calls to authorize), I open-up ComatoseController and add "skip_before_filter :authorize" followed-by "before_filter :my_authorize". This is necessary because ComatoseController has the "show" action as an exception to the authorize filter declaration (and I require authentication on "show"). I also disable caching on pages that are children of the "private" page (as well as the private page itself).
I'll probably be adding a "drafts" page to my page tree and modifying my authorize filter so that pages under it cannot be accessed via the "show" method under any circumstance. Being able to change the parent of a page easily makes such a feature simple to implement and use.
Thanks again for your great plugin.
- Scott
M@, I'm impressed by your development speed. There is a slight confusion in the docs, though: the Changelog says "Adds the utf8 header to all output (text/html; charset=utf-8). Use ComatoseController.force_utf8 = false to disable.", but the README says "You can tell Comatose to set the response headers to utf8 (text/html; charset=utf-8) by setting:
ReplyDeleteComatoseController.force_utf8 = true
By default, it's set to false."
I'll find out quickly which it is, of course, but I thought you wanted to know.
Nice release....
ReplyDeleteIm a couple of hours from releasing a build of my project using comatose....
thanks a bunch!
It's probably worth mentioning somewhere that the "none" text filter is actually a "newline to " text filter. It might be preferable to just have "none" actually do nothing and have a "simple" filter that converts newlines to line breaks.
ReplyDeleteI changed this code:
#
# NONE
#
TextFilters.define "None" do |text|
def render_text(text)
text.gsub("\n", '')
end
end
To this:
#
# NONE
#
TextFilters.define "None" do |text|
def render_text(text)
text
end
end
#
# SIMPLE
#
TextFilters.define "Simple" do |text|
def render_text(text)
text.gsub("\n", '')
end
end
It looks like all the <br/> (br tags) got filtered out of that last comment, making it read somewhat nonsensically.
ReplyDeletemakes sense to extract the admin part from the comatosecontroller...especially splitting the authorize for show/admin....
ReplyDeleteoops...forgot to mention....www.hill107 is running comatose as of 2 hours ago ;-)
ReplyDeletem@ yeah, frontpage, news, faq, about...will do a rss feed also using comatose.... I had to tweak it a bit to fit into my app, but otherwise i find comatose has a really nice level of (un)complexity....
ReplyDeleteoh...just found out the reordering pages updates the updated_on attribute...
ReplyDeletethats not what I expected...
Any way to get around this??
m@: yes...must be some way to override that??
ReplyDelete