Fork of Polar Humen’s Comatose Engine, http://github.com/polar/comatose_engine
- Removed photo management, is this even necessary?
- Rewritten with HAML and SASS support
- State column added for use with AASM (needs implemented)
- Role id foreign key column added for use with Roles (not implemented)
- Comatose-Rake-n-Bake, to autogenerate page structure based on Freemind Mind Map, http://github.com/scullygroup/Comatose-Rake-n-Bake
Note:
AASM and Role-based authorization are not currently implemented in this fork, however the database columns are present if you would like to use those systems. For an example application currently using this, check out http://github.com/scullygroup/scully-rails-template
Also, there are a few custom options included that can be specified in the configure block in your environment. Options include allow/disallow delete, allow/disallow add child, allow/disallow reordering, etc. See the included CONFIG file as an example.
Comatose Engine is an Engines Plugin of the popular Comatose plugin, enhanced with associating photos with pages with the attachment_fu plugin.
It’s intended for simple CMS support. Comatose Engine supports
- Nested pages
- Versioning
- Page markup in Textile, Markdown, RDoc, or easily add your own
- Page processing through Liquid or ERb
- Engines Ready for easy installation/migration
- Completely self-contained within plugin folder
It’s meant to be lean, mean, easily embedded, and easy to re-skin for existing applications.
Requirements:
- RAILS VERSION 2.3.4
- The engines plugin for Rails 2.3.4
This plugin includes the following plugins in “engine_plugins”, and they are git submodules.
- acts_as_list
- acts_as_tree
- pagnating_find
- respond_to_parent
You may have to remove them if they conflict with other versions that you are using.
- From the command line
$ rails site_name (create a rails app if you don't have one already)
- Install the engines plugin:
$ script/plugin install git://github.com/lazyatom/engines.git
- Put the comatose engine plugin into plugins directory (use one of the following methods):
- If you’re not using git, and just want to add the source files:
Download a tarball from https://github.com/bcalloway/comatose-engine/tarball/master and unpack it into /vendor/plugins/comatose\_engine
- Using git, make a shallow clone of the comatose_engine repository:
$ git clone --depth 1 git://github.com/bcalloway/comatose-engine.git vendor/plugins/comatose_engine
- If you want to keep your comatose_engine plugin up to date using git, you’ll have to add it as a submodule (http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#submodules)
git submodule add git://github.com/bcalloway/comatose-engine.git vendor/plugins/comatose_engine git submodule init git submodule update
- Make sure you rename your CE directory to `comatose_engine` (note the underscore) if it isn’t named that for some reason
- If you’re not using git, and just want to add the source files:
- Create your database and modify your `config/database.yml` appropriately.
- Delete public/index.html (if you haven’t already)
- Modify your environment.rb as indicated below:
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION # require File.join(File.dirname(__FILE__), 'boot') require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot') # Rails::Initializer.run do |config| config.plugins = [:engines, :comatose_engine, :all] config.plugin_paths += ["#{RAILS_ROOT}/vendor/plugins/comatose_engine/engine_plugins"] ... Your stuff here ... end # #Include your application configuration below require "#{RAILS_ROOT}/vendor/plugins/comatose_engine/engine_config/boot.rb"
- Modify your routes.rb as indicated below:
If you want default routes from the plugin add this after any of your own existing routes, but before the default rails routes:
map.from_plugin :comatose_engine
Otherwise, follow the Comatose Description for routes.
#map.resources "page_photos" #map.comatose_admin #map.comatose_root "home" # #Install the default routes as the lowest priority. map.connect ':controller/:action/:id' map.connect ':controller/:action/:id.:format'
- Generate the comatose engine migrations:
$ script/generate plugin_migration
- From the command line:
$ rake db:migrate
- You may need to change these lines in application_controller.rb (if you’re not using cookie sessions):
#See ActionController::RequestForgeryProtection for details #Uncomment the :secret if you're not using the cookie session store protect_from_forgery # :secret => 'your_secret_string'
- Run tests (remember, you must run ‘rake test’ before you can run the comatose_engine tests):
$ rake test $ rake comatose_engine:test
- Start your server and check out your site!
$ mongrel_rails start or $ ./script/server
You should be able to browse to http://127.0.0.1:3000/comatose_admin and start adding pages to your CMS.
Browsing to http://127.0.0.1:3000/ will render your comatose pages if routing doesn’t match any of your controllers.
NOTE: See CONFIG for an example configuration file using AutLogic, http://github.com/binarylogic/authlogic
To override the default configuration, you configure Comatose in your `config/environment.rb` file. Here is an example configuration block:
Comatose.configure do |config|
#Sets the text in the Admin UI's title area
config.admin_title = "Site Content"
config.admin_sub_title = "Content for the rest of us..."
end
Since this is Comatose, your Authorization and Admin Authorization procedures are still valid. Here’s an example that uses the AuthenticationSystem as generated by the restful_authentication plugin:
Comatose.configure do |config|
#Includes AuthenticationSystem in the ComatoseController
config.includes << :authenticated_system
config.admin_title = "Comatose - TESTING"
config.admin_sub_title = "Content for the rest of us..."
#
#Includes AuthenticationSystem in the ComatoseAdminController
config.admin_includes << :authenticated_system
#
#Calls :login_required as a before_filter
config.admin_authorization = :login_required
#
#Returns the author name (login, in this case) for the current user
config.admin_get_author do
current_user.login
end
end
However, now that Comatose is an Engines Plugin, you can just mix in methods in the ComatoseController and ComatoseAdminController.
Any views you create in your app directory will override those in `comatose_engine/app/views`.
For example, you could create `RAILS_ROOT/app/views/layouts/application.html.haml` and have that include your own stylesheets, etc.
You can also override ComatoseEngine’s controllers by creating identically-named controllers in your application’s `app/controllers` directory.
This plugin includes the work of many wonderful contributors to the Railsphere.
Following are the specific libraries that are distributed with Comatose. If I’ve
missed someone/something please let me know.
- Comatose by M@ McCray
- Liquid by Tobias Luetke
- RedCloth by _why
- Acts as Versioned by Rick Olsen
- Behaviors by Atomic Object LLC — very nice BDD-like testing library
- Engines by Lazy Tom
Comatose Engine is released under the MIT license.
- Engines, http://github.com/lazytom/engines
- Getting Started, http://comatose.rubyforge.org/getting-started-guide
- Liquid, http://home.leetsoft.com/liquid
- Tobias Luetke, http://blog.leetsoft.com
- RedCloth, http://whytheluckystiff.net/ruby/redcloth