Caboose CMS

Caboose is a simple yet flexible and powerful content management system that runs on top of ruby on rails. It handles users, roles, permissions, and the login process. In addition, it handles content pages and their URLs. It has a layout system that allows a developer to easily customize the look and feel of each page.


Install the caboose-cms gem:

$ gem install caboose-cms

Create a new rails app configured to use Caboose:

$ caboose new my_caboose_app

Now go create a local MySQL database called my_caboose_app_development. Then let Caboose install the database:

$ cd my_caboose_app
$ rake caboose:db

That's it! To test it out, start your rails server:

$ rails server

And go check out http://localhost:3000


Caboose already handles the page editing process, but you need to be able to control the layout for each of those pages. You do that with layouts. Caboose has a simple layout system. You control which layout each page uses. There are three options:

Default layout:

The layout that any page by default will use if any other layout options are not set. This layout resides in the layout_default.html.erb file.

Per page layout:

Just create a new layout called layout_<page_id>.html.erb.

<p>Example: <code>layout_37.html.erb</code></p>

Per type layout:

If you need multiple pages to use a common layout, just create a layout with a name.

Examples: layout_about.html.erb, layout_listing.html.erb

For each layout, a few things must exist in the layout for it to work properly with Caboose. You must include the following:

  • CSS and CSRF in the head:

    <%= yield :css %>
    <%= csrf_meta_tags %>
  • The top nav login/control panel link:

    <%= render :partial => 'layouts/caboose/top_nav' %>
  • The top nav login/control panel link:

    <%= render :partial => 'layouts/caboose/top_nav' %>
  • The station and javascript in the footer:

    <%= render :partial => 'layouts/caboose/station' %>
    <%= yield :js %>

You have access to the @page object in the layout. Here's a bare-bones example of all the elements:

<!DOCTYPE html>
<title>My App</title>
<%= yield :css %>
<%= csrf_meta_tags %>
<%= render :partial => 'layouts/caboose/top_nav' %>

<h1><%= raw @page.title %></h1>
<%= raw @page.content %>  

<%= render :partial => 'layouts/caboose/station' %>
<%= yield :js %>


To add new functionality to the Caboose station, extend the Caboose::CaboosePlugin object and override the methods you'd like to implement. The existing hooks are the following:

String page_content(String str)
Manipulate the page content before it's shown on the screen.
Array admin_nav(Array arr)
Add items to the navigation that appears in the Caboose station.